footballking3420 Posted June 11, 2008 Posted June 11, 2008 This is what I have so far:COUNT=0echo "You have entered $# arguments:"for ARG in $*doecho "#`expr $COUNT + 1`: $ARG"doneI can't seem to get the COUNT variable to increase for each listed argument. For example, if I enter something like:./FILE_NAME one two threeI ended up getting this:You have entered 3 arguments:#1: one#1: two#1: three
Zxian Posted June 11, 2008 Posted June 11, 2008 Normally, we don't help with homework (see Forum Rules #2c)... but I'll give you a small hint - look at what you're doing with count... you're simply adding one to the existing value and displaying the result (what happens to $COUNT after it's executed?).
footballking3420 Posted June 11, 2008 Author Posted June 11, 2008 Oh, I got it now. I had to add COUNT=`expr $COUNT + 1` as a second statement.
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now