Earlier quoted context omitted.
there's just no way we should all be scripting in a language where typing out anything more than a single command necessitates a cascade of "well ACKshually it should be done this way" corrections, whether it's from a static analysis tools or your grey-bearded Bash-wizard coworkers. We are eventually going to look at using bash and similar shells for scripting as the bad old days.
If there is only one correct answer to a problem in a given language, people will shunt that creativity to architecture or elsewhere. People still want to be creative in their work, programming and system administration is fundamentally a creative job. Which would you rather have, a script that was too clever by half, or a system architecture that was too clever by half? It's a whole lot easier to fix the script than…
Bash Pitfalls
31–35 of 35 posts
Re: Bash Pitfalls
#32(Disclaimer: I'm the co-developer) Together with GitHub user xPMo, I created a Shellcheck REPL tool ( https://github.com/HenrikBengtsson/shellcheck-repl ) that validates your Bash commands using ShellCheck _before_ they are evaluated. For example, $ words="lorem ipsum dolor" $ echo $words ^-- SC2086: Double quote to prevent globbing and word splitting. It was a toy project at first, but since I've learned so much abo…
Neat. I like it. I do have one suggestion: you have it ignoring "SC2154: 'var' is referenced but not assigned" by default, which makes sense on the command line because you're often not assigning and then referencing the same variable in a single command. But, I think it would be useful to have a similar warning like "SCREPL01: 'var' is not defined in the local environment," or something, which you might implement in…
> You'd also want to take into account special variables like $RANDOM and $HOSTNAME, but that's pretty trivial.
It seems like ShellCheck is already aware of these special Bash variable, e.g. 'echo $RANDOM' will not trigger SC2154 (or even SC2086 that otherwise asks you to quote variables).
Re: Bash Pitfalls
#33Re: Bash Pitfalls
#34(Disclaimer: I'm the co-developer) Together with GitHub user xPMo, I created a Shellcheck REPL tool ( https://github.com/HenrikBengtsson/shellcheck-repl ) that validates your Bash commands using ShellCheck _before_ they are evaluated. For example, $ words="lorem ipsum dolor" $ echo $words ^-- SC2086: Double quote to prevent globbing and word splitting. It was a toy project at first, but since I've learned so much abo…
Re: Bash Pitfalls
#35(Disclaimer: I'm the co-developer) Together with GitHub user xPMo, I created a Shellcheck REPL tool ( https://github.com/HenrikBengtsson/shellcheck-repl ) that validates your Bash commands using ShellCheck _before_ they are evaluated. For example, $ words="lorem ipsum dolor" $ echo $words ^-- SC2086: Double quote to prevent globbing and word splitting. It was a toy project at first, but since I've learned so much abo…