Simple bash question

Posted 30 November 2008 - 10:09 PM

I'm trying to be able to accept multiple arguments for a program, the way I've devised to go about this is to loop through the arguments list ($@) using the number of arguments ($#) as a max to stop at. My question is that in this format I have to call the specific command line argument variable name (1$, 2$, etc), and I have been unable to successfully set this.

I'm really new to bash so please excuse my ignorance.

crntarg=0
while [ $crntarg -ne $# ]
do
if [ $(($crntarg)) = "-n" ]; then <-------How do you define this variable name

...

fi
done

This post has been edited by Next2Nothing: 30 November 2008 - 10:11 PM