Just wrap the `pwd` in quotes to escape spaces. It’s just literally wrapping the output of pwd in a string “”.
$ > scp `pwd`/my_file.png foo # reads pwd spaces as argument separator $ > scp "`pwd`"/my_file.png foo
Yuji's Increasingly Infrequent Ramblings
Just wrap the `pwd` in quotes to escape spaces. It’s just literally wrapping the output of pwd in a string “”.
$ > scp `pwd`/my_file.png foo # reads pwd spaces as argument separator $ > scp "`pwd`"/my_file.png foo
~/playground/space in foldername$ `pwd`
-bash: /Users//playground/space: No such file or directory
They key part of this post is wrapping the command in quotes.
Just executing `pwd` is the same as typing the output of that command, so
~/playground/space in foldername$ `pwd`
Is the same as typing
~/playground/space in foldername
Which will result in “no such file or directory”, wheras wrapping in quotes will result in the command w/ spaces:
“`pwd`”