Bash — Escape spaces in results of `pwd` command

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 
About these ads
By Yuji Posted in Life

One comment on “Bash — Escape spaces in results of `pwd` command

  1. Pingback: Make $PWD or `pwd` handle spaces without crashing and burning | Code-a-thon

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s