Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-21-2012, 06:02 AM   #1
LQ Newbie
Registered: May 2012
Distribution: mix of ubuntu 15.04 and 15.10
Posts: 1

Rep: Reputation: Disabled
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.
Old 10-21-2012, 06:30 AM   #2
Wim Sturkenboom
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,786

Rep: Reputation: 282Reputation: 282Reputation: 282
$* is probably what you're looking for.
1 members found this post helpful.
Old 10-21-2012, 06:32 AM   #3
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,726
Blog Entries: 27

Rep: Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058Reputation: 2058
Member Response


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

Another good guide;
Linux Newbie Admin Guide

Last edited by onebuck; 10-21-2012 at 06:33 AM.
1 members found this post helpful.
Old 10-21-2012, 07:25 AM   #4
David the H.
Bash Guru
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959Reputation: 1959
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.

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

Last edited by David the H.; 10-21-2012 at 07:37 AM. Reason: stupid post duplication error
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to pass command line arguments from one shell script to another shell script VijayaRaghavanLakshman Linux - Newbie 5 01-20-2012 09:12 PM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 09:24 AM
shell script read line from file, use it in command DiGiGoth Programming 5 08-31-2008 11:08 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 09:44 AM

All times are GMT -5. The time now is 08:49 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration