etc...

suggest change

Positional parameters passed to the script from either the command line or a function:

#!/bin/bash
# $n is the n'th positional parameter
echo "$1"
echo "$2"
echo "$3"

The output of the above is:

~> $ ./testscript.sh firstarg secondarg thirdarg
firstarg
secondarg
thirdarg

If number of positional argument is greater than nine, curly braces must be used.

#  "set -- " sets positional parameters
set -- 1 2 3 4 5 6 7 8 nine ten eleven twelve
# the following line will output 10 not 1 as the value of $1 the digit 1
# will be concatenated with the following 0
echo $10   # outputs 1
echo ${10} # outputs ten
# to show this clearly:
set -- arg{1..12}
echo $10 
echo ${10}

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents