#!/bin/bash
set ‘apple pie‘ pears peaches
for i in $* /*单引号被去掉,循环单个字符输出*/
do echo $i
done
[[email protected] 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
[[email protected] Ex_14.02-14.31]# sh 14-14-2
apple pie pears peaches
[[email protected] Ex_14.02-14.31]#
-----------------------------------------------------------------
#!/bin/bash
set ‘apple pie‘ pears peaches
for i in [email protected] /*单引号被去掉,循环单个字符输出*/
do echo $i
done
[[email protected] Ex_14.02-14.31]# sh 14-14-3
apple
pie
pears
peaches
-----------------------------------------------------------------
#!/bin/bash
set ‘apple pie‘ pears peaches
for i in "[email protected]" /*每个位置参数都将当成一个加引号的字符串:"apple pie","pears ","peaches"*/
do echo $i
done
[[email protected] Ex_14.02-14.31]# sh 14-14-4
apple pie
pears
peaches
$*和[email protected]之间区别代码分析,布布扣,bubuko.com