1

Trying to keep spaces in the variable for read with the \.

$ echo "Drag folder to be copied to terminal and press ENTER."
$ read FILE
/Users/UserName/Desktop/Folder\ With\ Spaces\ In\ it
$ echo "$FILE"
/Users/UserName/Desktop/Folder With Spaces In it

The \ have been removed. I need them to remain as it will be used later in copy. Example.

$ cp -R $FILE /Volumes/USBName 

I have played with different quotation marks and looked around but nothing has worked for me so far. I may have to change the IFS, not sure?

Phil
  • 65

0 Answers0