argc/argv in bash!
How do we use argc and argv (C like) in bash scripts? Pavan Balaji, CIS Graduate Student, Ohio State University Being happy doesn't mean that everything is perfect... It just means that you have decided to see beyond the imperfections -- Rash To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
Re: argc/argv in bash!
On 2002-07-14 12:53 +, Balaji, Pavan wrote: How do we use argc and argv (C like) in bash scripts? The number of command line arguments is $#. For example: % cat foo.sh #!/bin/sh echo $# % sh foo.sh 0 % sh foo.sh hello world 2 % sh foo.sh hello world 1 The argv[] equivalent is $@. % cat foo2.sh #!/bin/sh for argument in $@ ;do echo $argument done % sh foo2.sh % % sh foo2.sh hello world hello world % % sh foo2.sh hello world hello world % For more details about the special variables of sh, read the sh(1) manpage. % man 1 sh To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message
RE: argc/argv in bash!
Thanx! Pavan Balaji, CIS Graduate Student, Ohio State University Being happy doesn't mean that everything is perfect... It just means that you have decided to see beyond the imperfections -- Rash -Original Message- From: Giorgos Keramidas [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 14, 2002 3:05 PM To: Balaji, Pavan Cc: '[EMAIL PROTECTED]' Subject: Re: argc/argv in bash! On 2002-07-14 12:53 +, Balaji, Pavan wrote: How do we use argc and argv (C like) in bash scripts? The number of command line arguments is $#. For example: % cat foo.sh #!/bin/sh echo $# % sh foo.sh 0 % sh foo.sh hello world 2 % sh foo.sh hello world 1 The argv[] equivalent is $@. % cat foo2.sh #!/bin/sh for argument in $@ ;do echo $argument done % sh foo2.sh % % sh foo2.sh hello world hello world % % sh foo2.sh hello world hello world % For more details about the special variables of sh, read the sh(1) manpage. % man 1 sh To Unsubscribe: send mail to [EMAIL PROTECTED] with unsubscribe freebsd-questions in the body of the message