for (( i=1; i<=$#; i++ ))
do
echo "$($i)" <---this is not correct, how should i fix that?
done
我想打印所有参数。
答案 0 :(得分:2)
for arg; do
echo "$arg";
done
或
for ((i=0; i<=${#@}; i++ )); do
echo "${!i}"
done
或
for arg in "$@"; do
echo "$arg";
done