Computing.Net > Forums > Unix > Command line arguments

Command line arguments

Reply to Message Icon

Original Message
Name: UnixNewbie
Date: April 16, 2004 at 08:29:33 Pacific
Subject: Command line arguments
OS: Win ME
CPU/Ram: 950 Mhz 128 MB
Comment:

Can anybody help me get started with this?
I have to write a script that takes any number of command line arguments, but quits when it finds a zero.
Any help is highly appreciated.
Thanks

UnixNewbie


Report Offensive Message For Removal


Response Number 1
Name: Dlonra
Date: April 17, 2004 at 11:07:31 Pacific
Reply: (edit)

a zero length list?
a parameter with value=0?
man sh or man ksh or man bash



Report Offensive Follow Up For Removal

Response Number 2
Name: David Perry
Date: April 19, 2004 at 04:34:41 Pacific
Reply: (edit)

if [ $# -eq ] ; then
exit 4
else
while [ $1 ] ; do
echo $1
shift
done
fi


Report Offensive Follow Up For Removal

Response Number 3
Name: David Perry
Date: April 19, 2004 at 11:09:52 Pacific
Reply: (edit)

typo. It should read

if [ $# -eq 0 ] ; then


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Command line arguments

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge