I want to output all arguments of a function one by one.
The function can receive many arguments, $# is the length of arguments.
showArg(){
num=$#
for order in `seq 1 ${num}`
do
echo $order
done
}
To execute it.
showArg x1 x2 x3
1
2
3
How to fix the echo statement echo $order
to get such the following output?
x1
x2
x3
I have tried echo $$order
.
To call every argument with "$@" in for loop can list it, but it is not the way I expected.
showArg(){
for var in "$@"
do
echo "$var"
done
}