Timeline for How to delete or access a file with a backslash \ in its name?
Current License: CC BY-SA 4.0
7 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Aug 14, 2018 at 22:58 | comment | added | mtraceur | @ilkkachu That's absolutely worth pointing out for someone learning the full set of shell escaping rules. That said, with someone doesn't know anything about shell escapes (as is the case with the person asking here) I always teach them single-quotes first, because I've seen far more non-obvious hard-to-debug problems from people aiming for literal strings and not remembering that some characters are special in double-quotes than than I've seen from people accidentally not getting the special interpretation they want from single-quotes. | |
| Aug 14, 2018 at 21:52 | history | edited | dannysauer | CC BY-SA 4.0 |
fixed a couple of "sash" which should have been consistently "backslash" :)
|
| Aug 14, 2018 at 21:51 | comment | added | dannysauer |
Good point, @ilkkachu. Then you get in to the third behavior of $'string', depending on the shell... Best not to rely on something "probably" working. :D
|
|
| Aug 14, 2018 at 21:45 | history | edited | dannysauer | CC BY-SA 4.0 |
typo
|
| Aug 14, 2018 at 21:41 | comment | added | ilkkachu |
Backslashes inside double-quotes only escape double-quotes, backslashes and backticks, so rm ".\*" would work too. (try echo " \" \* \' \\ ") Though single-quotes are clearer since at least the backslash is always a regular character there.
|
|
| Aug 14, 2018 at 21:37 | vote | accept | MetaStack | ||
| Aug 14, 2018 at 21:32 | history | answered | dannysauer | CC BY-SA 4.0 |