bash: passing paths with spaces as parameters?

前端 未结 4 907
北海茫月
北海茫月 2021-02-12 22:14

I have a bash script that recieves a set of files from the user. These files are sometimes under directories with spaces in their names. Unfortunately unlike this question all t

4条回答
  •  长发绾君心
    2021-02-12 22:47

    "$var"
    

    For example,

    $ var='foo bar'
    
    $ perl -E'say "<<$_>>" for @ARGV' $var
    <>
    <>
    
    $ perl -E'say "<<$_>>" for @ARGV' "$var"
    <>
    

提交回复
热议问题