码迷,mamicode.com
首页 > 系统相关 > 详细

shell脚本中大括号的扩展在变量中的问题

时间:2017-03-21 00:06:34      阅读:227      评论:0      收藏:0      [点我收藏+]

标签:shell

root@ubuntu:/tmp/test# touch /tmp/test/{2,3}

root@ubuntu:/tmp/test# ls

2  3

root@ubuntu:/tmp/test# rm /tmp/test/{2,3}

root@ubuntu:/tmp/test# ls


root@ubuntu:/tmp/test# t={2,3}

root@ubuntu:/tmp/test# touch /tmp/test/$t

root@ubuntu:/tmp/test# ls

{2,3}


解决办法:

root@ubuntu:/tmp/test# eval touch /tmp/test/$t

root@ubuntu:/tmp/test# ls

2  3


shell脚本中大括号的扩展在变量中的问题

标签:shell

原文地址:http://3732370.blog.51cto.com/3722370/1908609

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!