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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章