Tricky brace expansion in shell

前端 未结 4 1044
野趣味
野趣味 2021-01-02 11:34

When using a POSIX shell, the following

touch {quick,man,strong}ly

expands to

touch quickly manly strongly
<
4条回答
  •  轮回少年
    2021-01-02 11:48

    In bash, you can do this:

    #!/bin/bash
    TEST=quick,man,strong
    eval echo $(echo {$TEST}ly)
    #eval touch $(echo {$TEST}ly)
    

    That last line is commented out but will touch the specified files.

提交回复
热议问题