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
Use quotes to preserve the SPACE character
tr is used only for replacing individual characters 1 for 1. Seems to be that you need sed.
echo $FILE_PATH | sed -e 's/ /\\ /'
seems to do what you want.