by _where · 6y ago · 0 comments
Same theory for unset variable. Referencing an undefined variable shouldn’t break your session. Why initialize it anyway? It’s more code to change if you don’t use it if you have to initialize it when it might not be needed. And, you’d have to call the script with A= just to check A wasn’t defined, and in the process now you have A assigned to an empty string, instead of only defaulting to one when called, which uses more memory and execution time.
The pipeline doesn’t die because && and || and parens are seriously helpful for one-liners.
Don’t think of it as a script. Think of it as a script for a shell.
Bash is brilliantly useful for a lot of things. I’m not bashing it.
You have ${var:-} for doing that
The fallacy is: "By posting comments on the Internet, I can prevent people from using a tool I'm frustrated with. And I can make millions of lines of existing programs that I rely on go away."