I'm trying to pass a variable with spaces in it to sed using BASH, and in the prompt, it works fine:
$ tmp=/folder1/This Folder Here/randomfile.abc
$ echo "$tmp" | sed -e 's/ /\\ /g'
/folder1/This\ Folder\ Here/randomfile.abc
But as soon as I pass it to a variable, sed no longer replaces the space with a backslash:
$ tmp=/folder1/This Folder Here/randomfile.abc
$ location=`echo "$tmp" | sed -e 's/ /\\ /g'`
$ echo $location
/folder1/This Folder Here/randomfile.abc
I'm hoping a second pair of eyes can pick up on something that I'm not.