bash数组array[*]、array[@]、"array[*]"、"array[@]"
bash数组array[*]、array[@]、"array[*]"、"array[@]"
matrix=("hi" "hello world" "1 2 3")
for item in ${matrix[*]};do
echo ${item}
done
echo "========================================="
for item in ${matrix[@]};do
echo ${item}
done
echo "========================================="
for item in "${matrix[*]}";do
echo ${item}
done
echo "========================================="
for item in "${matrix[@]}";do
echo ${item}
done
# result:
# hi
# hello
# world
# 1
# 2
# 3
# =========================================
# hi
# hello
# world
# 1
# 2
# 3
# =========================================
# hi hello world 1 2 3
# =========================================
# hi
# hello world
# 1 2 3