标签:
done
[root@luozhonghua Ex_14.02-14.31]# sh 14-14-1
apple
pie
pears
peaches
--------------------------------------------------------------
#!/bin/bash
set ‘apple pie‘ pears peaches
for i in "$*" /*单引號被去掉。但当作字符串一次输出*/
do echo $i
done
[root@luozhonghua Ex_14.02-14.31]# sh 14-14-2
apple pie pears peaches
[root@luozhonghua Ex_14.02-14.31]#
-----------------------------------------------------------------
#!/bin/bash
set ‘apple pie‘ pears peaches
for i in $@ /*单引號被去掉。循环单个字符输出*/
do echo $i
done
[root@luozhonghua Ex_14.02-14.31]# sh 14-14-3
apple
pie
pears
peaches
-----------------------------------------------------------------
#!/bin/bash
set ‘apple pie‘ pears peaches
for i in "$@" /*每一个位置參数都将当成一个加引號的字符串:"apple pie","pears ","peaches"*/
do echo $i
done
[root@luozhonghua Ex_14.02-14.31]# sh 14-14-4
apple pie
pears
peaches
标签:
原文地址:http://www.cnblogs.com/gcczhongduan/p/5092993.html