Timeline for Tips for golfing in Bash
Current License: CC BY-SA 3.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 24, 2017 at 17:22 | comment | added | F. Hauri - Give Up GitHub |
@DigitalTrauma Sample of nesting: echo `bc <<<"\`date +%s\`-12"` ... (It's hard to post sample containing backtick in comment, there! ;)
|
|
Sep 24, 2015 at 7:43 | comment | added | undergroundmonorail | @PeterCordes I'm sure there was a way but everything I tried at the time didn't work. Even if backticks weren't the best solution, I was glad I knew about them because it was the only solution I had. ¯\_(ツ)_/¯ | |
Sep 24, 2015 at 7:09 | comment | added | Peter Cordes |
@undergroundmonorail: you never need backticks. Anything they can do, $() can do if you quote things properly. (unless you need your command to survive something that munges $ but not backticks). There are some subtle differences in quoting things inside them. mywiki.wooledge.org/BashFAQ/082 explains some differences. Unless you're golfing, never use backticks.
|
|
Feb 20, 2015 at 2:55 | history | wiki removed | Doorknob | ||
Jun 3, 2014 at 20:18 | history | edited | user16402 | CC BY-SA 3.0 |
deleted 4 characters in body
|
Apr 21, 2014 at 19:31 | comment | added | undergroundmonorail |
These technically do different things, I've had to use the backticks instead of $() when I wanted to run the substitution on my machine instead of the scp target machine, for example. In most cases they're identical.
|
|
Apr 13, 2014 at 4:18 | comment | added | Digital Trauma |
Sometimes $( ) is needed if you have nested command substitutions; otherwise you'd have to escape the inner ``
|
|
Apr 9, 2014 at 13:45 | history | answered | user16402 | CC BY-SA 3.0 |