Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Shell confusion over positional arguments



	Hello.  I've modified the test script, shown below, as indicated in the examples.  
However, I see no change.  For the positional arguments 10 and 11, I should now see:
testarg10 and testarg11 respectively.  Yet I still see the value of $1 followed by a 0 and 1
respectively.

Do I need to put the $ in braces as well?

-thanks
-Brian


#!/bin/sh
# Test retrieving command arguments by using numeric values.

arg1=$1
arg2=$2
arg3=$3
arg4=$4
arg5=$5
arg6=$6
arg6=$6
arg7=$7
arg8=$8
arg9=$9
arg10=${10}
arg10=${10}
arg11=${11}

# Now, print the arguments we  received.
echo "arg1 = $1"
echo "arg2 = $2"
echo "arg3 = $3"
echo "arg4 = $4"
echo "arg5 = $5"
echo "arg6 = $6"
echo "arg7 = $7"
echo "arg8 = $8"
echo "arg9 = $9"
echo "arg10 = $10"
echo "arg11 = $11"

exit 0


#!/bin/sh

./testarg -cmd1 -cmd2 cmd3 cmd4 cmd5 cmd6 cmd7 cmd8 cmd9 testarg10 testarg11
exit 0


Home | Main Index | Thread Index | Old Index