Using a variable containing spaces as a single argument

前端 未结 1 1642

Think you have a variable that contains a string of text with spaces inbetween and you want to use that as input arguments for another script. How would you go about passing

相关标签:
1条回答
  • 2020-12-22 06:30

    Use double quotes:

    VAR1=hello\ world
    #... do something else
    ./a_script.sh "$VAR1"
    
    0 讨论(0)
提交回复
热议问题