[opensuse] Bash script which read command option
Hi People, How can I have my bash script read the option I pass in command line? Let's suppose the script looks like this: #!/bin/bash ping -c "?" 192.168.1.1 I want to have that number of count passed by command line when I launch the script. For example: # ./script 5 would execute ping -c 192.168.1.1 TIA, Jan -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 18-01-2007 at 16:34, jan kalcic
wrote: Hi People, How can I have my bash script read the option I pass in command line?
Let's suppose the script looks like this:
#!/bin/bash
ping -c "?" 192.168.1.1
Variables will be your friend in this case. $1 being the first parameter, $2 the 2nd, and so on... man bash is probably a good start for you too. dominique -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 18 January 2007 06:58, Dominique Leuenberger wrote:
...
man bash is probably a good start for you too.
Perhaps. Perhaps not. I'm all for documentation, of course (and for reading it), but BASH is pretty complicated and probably a gentler introduction is in order for someone who is so near the beginning of their learning curve on shell scripting. A Google search for "BASH Tutorial" gets many hits, not surprisingly.
dominique
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Randall R Schulz
On Thursday 18 January 2007 06:58, Dominique Leuenberger wrote:
...
man bash is probably a good start for you too.
Perhaps. Perhaps not.
I'm all for documentation, of course (and for reading it), but BASH is pretty complicated and probably a gentler introduction is in order for someone who is so near the beginning of their learning curve on shell scripting.
A Google search for "BASH Tutorial" gets many hits, not surprisingly.
Better recommendations would perhaps be: Rute abs-guide -- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2 OpenSUSE Linux http://en.opensuse.org/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 18 January 2007 07:22, Patrick Shanahan wrote:
...
A Google search for "BASH Tutorial" gets many hits, not surprisingly.
Better recommendations would perhaps be: Rute abs-guide
By which I guess you mean these: - Rute http://rute.2038bug.com/ http://rute.2038bug.com/rute.html.gz (browse) http://rute.2038bug.com/rute.html.tar.bz2 (download) http://www.icon.co.za/~psheer/rute.pdf.bz2 - abs-guide ("Advanced BASH Scripting Guide") http://tldp.org/LDP/abs/abs-guide.pdf
-- Patrick Shanahan
Randall Schulz -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 18 January 2007 07:07, Randall R Schulz wrote:
On Thursday 18 January 2007 06:58, Dominique Leuenberger wrote:
...
man bash is probably a good start for you too.
Perhaps. Perhaps not.
I'm all for documentation, of course (and for reading it), but BASH is pretty complicated and probably a gentler introduction is in order for someone who is so near the beginning of their learning curve on shell scripting.
A Google search for "BASH Tutorial" gets many hits, not surprisingly.
dominique
Randall Schulz
Learning the Bash shell http://www.oreilly.com/catalog/bash3/ Mike -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Thursday 18 January 2007 05:22, Patrick Shanahan wrote:
* Randall R Schulz
[01-18-07 10:10]: On Thursday 18 January 2007 06:58, Dominique Leuenberger wrote:
...
man bash is probably a good start for you too.
Perhaps. Perhaps not.
I'm all for documentation, of course (and for reading it), but BASH is pretty complicated and probably a gentler introduction is in order for someone who is so near the beginning of their learning curve on shell scripting.
A Google search for "BASH Tutorial" gets many hits, not surprisingly.
Better recommendations would perhaps be: Rute abs-guide
Thanks, Jerome
-- Patrick Shanahan Registered Linux User #207535 http://wahoo.no-ip.org @ http://counter.li.org HOG # US1244711 Photo Album: http://wahoo.no-ip.org/gallery2 OpenSUSE Linux http://en.opensuse.org/ -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (7)
-
Dominique Leuenberger
-
jan kalcic
-
Mike Noble
-
Patrick Kirsch
-
Patrick Shanahan
-
Randall R Schulz
-
Susemail