| ▲ | kevincox a day ago | |||||||||||||
I am not a huge fan of most of these, but a few do seem useful.
I wouldn't use this because I would want to give $1 a name for the rest of the script, so I would assign. But it can be a nice way to give a clear error for missing required environment variables.Many of the others (like truncating files) are probably more clearly written with dedicated commands, but may come in useful if you are going to extreme lengths to avoid dependencies outside of the shell. | ||||||||||||||
| ▲ | refp 6 hours ago | parent | next [-] | |||||||||||||
Yo, author here. You are very much correct and I 100% agree with you, I have updated the first example to include a snippet where a proper env-var is used to show of the automatic diagnostic. Thanks for your feedback, much much appreciated! | ||||||||||||||
| ||||||||||||||
| ▲ | yjftsjthsd-h 5 hours ago | parent | prev | next [-] | |||||||||||||
Agreed; author does note > Why use the null-command when I could do VAR=${VAR:-default-value}? and points out it's one less thing to typo, but that assumes the name is the same; I like e.g. | ||||||||||||||
| ▲ | 6 hours ago | parent | prev | next [-] | |||||||||||||
| [deleted] | ||||||||||||||
| ▲ | akoboldfrying 4 hours ago | parent | prev | next [-] | |||||||||||||
"Shortcuts" like :? that tie together two unrelated things (checking a variable for a condition, expanding the value of that variable) drive me up the wall. It makes expressing just one of the two things harder than expressing both, leading to contortions when you want just one, like this use of :. | ||||||||||||||
| ▲ | notpushkin 6 hours ago | parent | prev [-] | |||||||||||||
[dead] | ||||||||||||||