How can I traverse through 2nd argument to last argument like:
for arg in $2-$@
do
echo $i
done
Please help
Actually, don't trust the arguments... they may contain spaces, or other special meta characters to the shell. Double quotes are your friends in shell scripts.
shift; #eat $1 for arg in "$@" do echo "$arg" done
When put in double quotes the "$@" takes on special magic to assure words are retained. Much better then $*. "$*" would process all arguments at once.
Double quotes are not a perfect solution, just the best easy one.