Ever since shellcheck came around I have been writing all my scripts in POSIX sh. Its not that bad actually and knowing stuff is just more compatible is worth that little friction.
Shellcheck has been a huge game changer for me. The lack of a linter is the main reason I don't consider switching to zsh anymore.
When I first found shellcheck, I'd sit on the train every morning and fix all the stupid little bugs in all our shell code. I learned a TON about shell scripting, because the shellcheck wiki is amazing. We had some redhat 6 init scripts checked into our repos, and shellcheck helpd me find syntax errors in those init scripts. If Redhat can't reliably write shell scripts without a linter, or catch bugs from upstream, what makes us think we're any better?
I wouldn't write serious programs in another language without a linter. Why should I write shell scripts without one?
You shouldn't be writing serious programs in Bash/Zsh at all, is the issue. If it's complex enough to need linting, it's complex enough to require Python/Perl.
Writing all your scripts that way is one thing. I’m not that far off, although I write all my shell functions and things like that in fish. But avoiding using tools that may not be universally available means never using ripgrep or fd or fish or newer versions of bash or any of the other nice updates we have now, and that sounds awful.
I would rather limit myself to things I know are going to be preinstalled on the platforms I use than deal with the masochism that is scripted dependency management. No thanks.
All these comments here "Uhhh just use PythoN!" Yeah? I write scripts that need to run on macOS. No Python there. Yeah I can have my script sit there and pull the command line tools in an automated way and wait the 20 minutes it takes to install or I can pull on my big boy pants and just figure out how to do it in shell. It's turing complete. It works. Whatever.
macOS has not shipped with Python installed in 6 years. If you take a Mac out of the box, open terminal, and run `python` it prompts you in the GUI to install the Command Line Developer Tools.
Ever since shellcheck came around I have been writing all my scripts in POSIX sh. Its not that bad actually and knowing stuff is just more compatible is worth that little friction.
Shellcheck has been a huge game changer for me. The lack of a linter is the main reason I don't consider switching to zsh anymore.
When I first found shellcheck, I'd sit on the train every morning and fix all the stupid little bugs in all our shell code. I learned a TON about shell scripting, because the shellcheck wiki is amazing. We had some redhat 6 init scripts checked into our repos, and shellcheck helpd me find syntax errors in those init scripts. If Redhat can't reliably write shell scripts without a linter, or catch bugs from upstream, what makes us think we're any better?
I wouldn't write serious programs in another language without a linter. Why should I write shell scripts without one?
You shouldn't be writing serious programs in Bash/Zsh at all, is the issue. If it's complex enough to need linting, it's complex enough to require Python/Perl.
Writing all your scripts that way is one thing. I’m not that far off, although I write all my shell functions and things like that in fish. But avoiding using tools that may not be universally available means never using ripgrep or fd or fish or newer versions of bash or any of the other nice updates we have now, and that sounds awful.
I would rather limit myself to things I know are going to be preinstalled on the platforms I use than deal with the masochism that is scripted dependency management. No thanks.
All these comments here "Uhhh just use PythoN!" Yeah? I write scripts that need to run on macOS. No Python there. Yeah I can have my script sit there and pull the command line tools in an automated way and wait the 20 minutes it takes to install or I can pull on my big boy pants and just figure out how to do it in shell. It's turing complete. It works. Whatever.
MacOS doesn’t have python? What?
macOS has not shipped with Python installed in 6 years. If you take a Mac out of the box, open terminal, and run `python` it prompts you in the GUI to install the Command Line Developer Tools.
Thanks GPLv3