shell中双引号的误用

for i in "$LIST":
#!/bin/bash

LIST="a b c d"

echo "first type"
for i in $LIST
do
        echo $i;
done
echo -e "\n\n";

echo "second type"
for i in "$LIST"
do
        echo $i
done

结果:

first type

a

b

c

d

second type

a b c d

猜你喜欢

转载自andylin02.iteye.com/blog/1041270