Unix command to escape spaces

后端 未结 7 1350
春和景丽
春和景丽 2020-12-14 07:21

I am new to shell script. Can someone help me with command to escape the space with \"\\ \". I have a variable FILE_PATH=/path/to my/text file ,
I want to escape the spa

相关标签:
7条回答
  • 2020-12-14 08:07

    There's more to making a string safe than just escaping spaces, but you can escape the spaces with:

    FILE_PATH=$( echo "$FILE_PATH" | sed 's/ /\\ /g' )
    
    0 讨论(0)
提交回复
热议问题