LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-21-2012, 07:02 AM   #1
miillerje
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.
jem
 
Old 10-21-2012, 07: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
http://answers.oreilly.com/topic/149...ell-variables/
$* is probably what you're looking for.
 
1 members found this post helpful.
Old 10-21-2012, 07:32 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,542
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
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

Last edited by onebuck; 10-21-2012 at 07:33 AM.
 
1 members found this post helpful.
Old 10-21-2012, 08: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: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.

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


Reply


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 10:12 PM
how to pass command-line parameter to shell script? Kropotkin Linux - Newbie 12 07-25-2011 10:24 AM
shell script read line from file, use it in command DiGiGoth Programming 5 08-31-2008 12:08 PM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 10:16 AM
Shell Script to read 500files from the command line saravanan1979 Programming 1 09-22-2004 10:44 AM


All times are GMT -5. The time now is 11:00 AM.

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