build argument lists containing whitespace

前端 未结 5 1525
一生所求
一生所求 2020-12-01 13:24

In bash one can escape arguments that contain whitespace.

foo \"a string\"

This also works for arguments to a command or function:

5条回答
  •  时光说笑
    2020-12-01 13:42

    You can use the arrays just as you suggest, with a small detail changed. The line calling foo should read

     foo "${args[@]}"
    

提交回复
热议问题