$ cat args
echo "$#"
for arg in "$*"
do
echo $arg
done
$ args 'e f ' g
2
e
f
g
为什么e f会分行显示?
简单的脚本问题……
- jioyo源
- 帖子: 3476
- 注册时间: 2008-10-08 13:48
简单的脚本问题……
上次由 jioyo源 在 2009-05-04 18:49,总共编辑 1 次。
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
- eexpress
- 帖子: 58428
- 注册时间: 2005-08-14 21:55
- 来自: 长沙
- HFUTec
- 帖子: 48
- 注册时间: 2009-03-20 8:52
Re: 简单的脚本问题……
我刚在我的ubuntu8.10上运行你的脚本,没发现这个问题啊
-
- 帖子: 49
- 注册时间: 2007-03-17 1:15
Re: 简单的脚本问题……
2
e f g
我的结果是这样。。。。
debian lenny
e f g
我的结果是这样。。。。
debian lenny
- jioyo源
- 帖子: 3476
- 注册时间: 2008-10-08 13:48
Re: 简单的脚本问题……
意思shell对参数进行处理时去掉了单引号,然后被for分行输出.?eexpress 写了:shell 改变的。分解参数了。
- 附件
-
- Screenshot-20.png (4.9 KiB) 查看 850 次
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
- bones7456
- 帖子: 8495
- 注册时间: 2006-04-12 20:05
- 来自: 杭州
- 联系:
- jioyo源
- 帖子: 3476
- 注册时间: 2008-10-08 13:48
Re: 简单的脚本问题……
bashbones7456 写了:bash?dash?
--------------------------------------
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
论坛精华贴全集:http://forum.ubuntu.org.cn/viewtopic.php?f=48&t=199845
book:http://forum.ubuntu.org.cn/viewtopic.php?f=21&t=198286
- hellojinjie
- 帖子: 1150
- 注册时间: 2007-09-14 21:03
- 来自: 浙江