LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 06: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, 06:30 AM   #2
Wim Sturkenboom
Senior Member
 
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Ubuntu 12.04, Antix19.3
Posts: 3,794

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, 06:32 AM   #3
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,925
Blog Entries: 44

Rep: Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159Reputation: 3159
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 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: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
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 07:37 AM. Reason: stupid post duplication error
 
1 members found this post helpful.
  


Reply



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:32 PM.

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
Open Source Consulting | Domain Registration