I tend to prefix oft-used files and folders with the "accent grave" character (non-shift tilde, the back-tick, or plain-old accent, whathaveyou..), as it is easy to get at, and let's me sort things alphabetically, while letting me choose to show a few items on the top. It works nicely, except when I go to access these files via the CLI or SSH/SCP.
If I try to run a command, calling the file unescaped ↝ it kicks me into an interactive session.. for example ↯
# scp -r dns.local:/`Downloads/CrazyRussianCars/ ~/
↩
>
Yet if I try the logical solution ↯
# scp -r dns.local:/\`Downloads/CrazyRussianCars/ ~/
↩
bash: -c: line 0: unexpected EOF while looking for matching ``'
bash: -c: line 1: syntax error: unexpected end of file
I know the "new" rule is to use a syntax like export NOW=$(date)
vs export NOW=
`date` (in fact, I had a bear of a time even writing the latter in SE MD syntax…) but this is unrelated to the ENV
or any script…
Note: This is a Mac OS X environment, but that said, the GUI has never had a problem dealing with this character on a day-to-day basis, and usually, if there's going to be a syntax problem in the Terminal, Apple does a pretty good job of disabling the behavior in the GUI… Not sure if this is a bug, or if the technique for dealing with such paths is simply obscure.. but so far, I have been un-able to find a way "to escape it"?
Best Answer
You can use 3 backslashes as mentioned by Jed Daniels or you can wrap it in single quotes
(')
and use a single backslash.Example of both are below.