How can I traverse through 2nd argument to last argument
like:
for arg in $2-$@
do
echo $i
done
Please help
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.
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.