News for hackers. Stuff that matters.
Re:Shellcheck finds bugs in your shell scripts by ulrischa on Thursday November 23, 2023 @02:53PM (#38396791)
Saves a lot of time for tons of legacy shell scripts
Re:Shellcheck finds bugs in your shell scripts by hapulala89 on Thursday November 23, 2023 @03:01PM (#38396864)
I have a colleague that writes alot of shellscripts and there is an ongoing discussion if shellcripts or scripting languages like python is better.
Re:Shellcheck finds bugs in your shell scripts by sneed_chucker on Thursday November 23, 2023 @03:19PM (#38397082)
Python's subprocess/shell-out story is just bad enough that I still find myself writing a lot of shell scripts if the task at hand warrants more than 2-3 subprocess calls.

Realistically, Perl or Ruby would fill this role fine, but I hate adding another language to a project just for that purpose.

Re:Shellcheck finds bugs in your shell scripts by pletnes on Thursday November 23, 2023 @03:53PM (#38397411)
Agree, and also you have to write a few lines of shell to get your python going (and same for node or ruby or whatever).
Re:Shellcheck finds bugs in your shell scripts by pram on Thursday November 23, 2023 @03:12PM (#38397006)
It’s perfectly fine for glue type stuff in a CI pipeline imo. There’s frankly no easier way to work with files.
Re:Shellcheck finds bugs in your shell scripts by agumonkey on Thursday November 23, 2023 @03:07PM (#38396946)
i remember trying to rewrite so fragile scraping bash script in python, and even with some effort to use nice libs and create some cool helpers it ended up as long and not much more solid

bash is infectious in the bad sense :D

Re:Shellcheck finds bugs in your shell scripts by ovex on Thursday November 23, 2023 @04:42PM (#38397906)
From a security point of view, Python is better because it is less of a footgun. So if you expose an interface to untrusted users, you should use Python because its behavior is more intuitive. An arithmetic expansion or missing quotes do not easily become a vulnerability in Python.
Re:Shellcheck finds bugs in your shell scripts by Schnitz on Thursday November 23, 2023 @04:56PM (#38398008)
We ported all shell scripts to Python at a company that I’ve worked for. Scripts just kept getting longer and more complex. As a language Python is great, super fast and easy to code in, very little inherent complexity. The reason I wouldn’t choose Python again is distribution. It’s easy enough in Docker, you can just bite the bullet and vendor the same Python in all Docker containers. Mac was a pain though, pyenv etc all had their own issues and collisions with homebrew and dependency management with pip is a hassle as big as npm. A real bummer given how well Python works as a language for scripting.