You are not logged in.
When programming in BASH, you may use the syntax '$1 $2 $3 ...' to specify which token/argument you want to do something with. Is there an existing function that allows for unlimited argument selection? I'm looking for something along the lines of this:
~$ cat MY_SCRIPT
#!/bin/bash
echo ${unlimited arguments}
~$ bash MY_SCRIPT cat dog horse
cat dog horse
Edit: Please forgive my rudimentary BASH skills
Last edited by deltaecho (2008-08-29 10:41:57)
Dylon
Offline
#!/bin/bash
echo $*
Here is a very useful bash guide for you: http://tldp.org/LDP/abs/html/
Offline
If you want to do something with each argument, you could use this:
#!/bin/bash
for ARG in "$@"
do
echo $ARG
done
Last edited by Xyne (2008-08-29 02:42:35)
My Arch Linux Stuff • Forum Etiquette • Community Ethos - Arch is not for everyone
Offline
Awesome! That's exactly what I was looking for, thanks!
Dylon
Offline