3 ms·
This is a rather long list so i'll just mention my latest favorite which I recently learned on HN and it has made my life very easy with bash Whenever you need
by superasn 4y ago
This is a rather long list so i'll just mention my latest favorite which I recently learned on HN and it has made my life very easy with bash
Whenever you need to use a single-quote on command line add a $ sign before it. It makes escaping everything super easy
su user -c $'cd \'$dir\' && ...'
Before this it used to confuse the hell out of me.
More details are here: https://stackoverflow.com/a/16605140/1031454 https://stackoverflow.com/a/16605140/1031454
- mdaniel 4y agoI know that may be convenient, but you'll want to exercise caution because $'' turns on inner escaping that wouldn't otherwise happen inside single-quoted strings $ echo 'hello \"world' hello \"world $ echo $'hello \"world' hello "world