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

Re: What's the meaning of "echo $@"?



On Mon, May 27, 2002 at 10:25:28AM +0800, Squirrel wrote:
where's the question?

oh, it's in the subject.  how about putting the message in the
message?

The question was :
    What's the meaning of "echo $@"?

To start with, 'echo' is a command.  Depending on your shell it is
either built-in or it is /bin/echo (in bash it is built in).  It is
explained in the 'echo' manpage (if using /bin/echo) or the 'bash'
manpage (if using bash's built-in echo).  

The "$@" part is an argument to echo.  Names beginning with $ are
shell variables and are expanded by the shell before the application
sees them.  In the bash manpage :

~~~~
   Special Parameters

       @      Expands to the positional parameters, starting from one.
              When the expansion occurs within double quotes, each
              parameter  expands to  a separate word.  That is, "$@"
              is equivalent to "$1" "$2" ...  When there are no
              positional parameters, "$@" and $@ expand to nothing
              (i.e., they are removed).
~~~~

-D

-- 

"Don't use C;  In my opinion,  C is a library programming language
 not an app programming language."  - Owen Taylor (GTK+ developer)
 
GnuPG key : http://dman.ddts.net/~dman/public_key.gpg

Attachment: pgp4H9LRRn7o9.pgp
Description: PGP signature


Reply to: