LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   there is one name 4 for command-line-parameters in shell script (https://www.linuxquestions.org/questions/linux-newbie-8/there-is-one-name-4-for-command-line-parameters-in-shell-script-4175433327/)

miillerje 10-21-2012 06:02 AM

there is one name 4 for command-line-parameters in shell script
 
please i only ask for the name for all parameters given to a shell-script; $1 means the first, $2 the second and so on . Is it $?, $#, $~ or what? I dont remember. I thanks a lot 4 all helping answer. An internet adress for looking in a table, a tutorial or something else would be enough.
jem

Wim Sturkenboom 10-21-2012 06:30 AM

http://answers.oreilly.com/topic/149...ell-variables/
$* is probably what you're looking for.

onebuck 10-21-2012 06:32 AM

Member Response
 
Hi,

For bash you can learn from;
Bash Beginners Guide
Bash Reference Manual
Advanced Bash-Scripting Guide

Another good guide;
Linux Newbie Admin Guide

David the H. 10-21-2012 07:25 AM

Actually, you'll usually want to use "$@".

It expands to the entire list of arguments, and when quoted each argument is treated as a separate element. This is the behavior you'll usually want when running loops and passing the arguments to other commands.

"$*", on the other hand, expands to the entire list of arguments as a single text string. You'll only want to use this in certain printing and testing situations.

Note that the quotes are important for protecting the contents against shell word-splitting in either case, so never forget to quote.

http://mywiki.wooledge.org/Arguments
http://mywiki.wooledge.org/WordSplitting
http://mywiki.wooledge.org/Quotes


The "@" and "*" values work the same way when used as array indexes as well.


All times are GMT -5. The time now is 02:01 AM.