[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Redhat] Doubt on shellscripts

--- "B, Prasada Rao (Cognizant)" <BPrasada chn cognizant com> wrote:
> Hi friends,
> I have few doubts, they are ....... 
> 1.  In any scripting language (bash, ksh, ..etc)   # indicates the comment right. But in the
> first line for any script we need to start some thing like #!/bin/bash   or 
> #!/bin/ksh.
> Here I think # is not a comment. But how the system will identify The # in the first line is not
> a comment and in other lines is a comment?

Correct.  The #!/bin/program notation on the first line calls the correct program
to interpret the code...where "program" is: ksh, sh, bash, tcsh, zsh, perl, etc....
> 2. What is $? is

The value of the shell built-in variable $? is the exit status of the last
command or the result of a conditional test, i.e. [ -f memo ]. Zero exit is
true or success, otherwise non-zero (1-255)

> 3. What $1 returns ? Will it return the second variable value?

Variables names that are numbers... are called positional paramaters. Elements
of a command line are assigned to these parameters, as in the following example
$0   $1   $2     $3   $4    $5
cp memo report data1 data2 Save

There are tons of cheap books at all levels on shell programming. You
will find a free bash "guide" here: http://www.tldp.org/guides.html

> For the above queries I have tried in www.google.com and http://vivisimo.com/ . But I coudnt
> find useful info.
> Please some one in our mailing list let me know the answers. 
> Thanks and rgds,
> Prasad Rao.
> > This e-mail and any files transmitted with it are for the sole use of the intended
> and may contain confidential and privileged information.
> If you are not the intended recipient, please contact the sender by reply e-mail and destroy all
> copies of the original message. 
> Any unauthorised review, use, disclosure, dissemination, forwarding, printing or copying of this
> email or any action taken in reliance on this e-mail is strictly 
> prohibited and may be unlawful.
> 		Visit us at http://www.cognizant.com

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]