I want to iterate over the argument list in shell, I know how to do this with
for var in $@
But I want to do this with
for ((i=3; i<=$#; i++))
I need this because the first two arguments won't enter into the loop. Anyone knows how to do this? Looking forward to you help.
cheng
This might help:
for var in "${@:3}"
for more information you can look at:
http://www.ibm.com/developerworks/library/l-bash-parameters/index.html
reader_1000 provides a nice bash incantation, but if you are using an older (or simpler) Bourne shell you can use the creaking ancient (and therefore highly portable)
VAR1=$1
VAR2=$2
shift 2
for arg in "$@"
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With