#!/bin/sh
echo "Test Use Array 1"
ITEMARR="1 2 3"
for channel in ${ITEMARR[@]}; do
echo "item index:" $channel
done
echo "Test Use Array 2"
for channel in "1 2 3"; do
echo "item index:" $channel
done
echo "Test Use Array 3"
for channel in 1 2 3; do
echo "item index:" $channel
done
输出结果如下:
Test Use Array 1
item index: 1
item index: 2
item index: 3
Test Use Array 2
item index: 1 2 3
Test Use Array 3
item index: 1
item index: 2
item index: 3