1 2 3 等...
從命令列或函式傳遞給指令碼的位置引數:
#!/bin/bash
# $n is the n'th positional parameter
echo "$1"
echo "$2"
echo "$3"
以上的輸出是:
~> $ ./testscript.sh firstarg secondarg thirdarg
firstarg
secondarg
thirdarg
如果位置引數的數量大於 9,則必須使用花括號。
# "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}