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
FILE_PATH=/path/to my/text file
FILE_PATH=echo FILE_PATH | tr -s " " "\\ "
That second line needs to be
FILE_PATH=echo $FILE_PATH | tr -s " " "\\ "
but I don't think it matters. Once you have reached this stage, you are too late. The variable has been set, and either the spaces are escaped or the variable is incorrect.
FILE_PATH='/path/to my/text file'