3 ms·
It's not as nice, "cat $today" is easier to type than "cat $(today)" and would give better completion, just declared matching variables instead of matching func
by flukus 8y ago
It's not as nice, "cat $today" is easier to type than "cat $(today)" and would give better completion, just declared matching variables instead of matching functions, files and executables.
On the plus side, TIL the subshell syntax plays well with eval/expand shortcut (ctrl+alt+e).
- Vogtinator 8y agoIt's not obvious that just expanding a variable runs code though.
- hawski 8y agoWouldn't "cat $today" result with "cat: No such file or directory: 2019-01-08"? Did you mean echo instead of cat?
- forty 8y agoOnly in the case when no such file exists in the current directory :)
- flukus 8y agoMy real life use case for these dynamic variables would be more like "cat/vim/cp $log" to get today's log file which would expand to something like /somedir/logs/201901/09/product.log. Handy when you have a large matrix of products/environments.
- edoloughlin 8y ago* "cat $today" is easier to type than "cat $(today)"* Except you should really be in the habit of typing "cat ${today}" ;)
- yjftsjthsd-h 8y agoExcept you should really be in the habit of typing `cat "${today}"` ;) Quote everything!
- LukeShu 8y agoWhy? The {} doesn't prevent glob expansion or field separation.