shell脚本中大括号的扩展在变量中的问题
root@ubuntu:/tmp/test# touch /tmp/test/{2,3}root@ubuntu:/tmp/test# ls
23
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
23
页:
[1]