4 ms·
One important con that isn't mentioned: It's so unnecessarily confusing how to write a shell script that can properly deal with whitespace, dollar signs or othe
by codeflo 4y ago
One important con that isn't mentioned: It's so unnecessarily confusing how to write a shell script that can properly deal with whitespace, dollar signs or other special characters in filenames.
Of course it's possible and learnable. But even if you know the tricks, it's tedious, and human error prone. I had a team mate (many years ago) who used to test the local admins at any new workplace by putting files names named "$HOME" and similar in his home directory. He claimed it wasn't that rare for this to crash some backup script.
Yet this isn't inherently hard. In fact it's trivial in literally any "proper" programming language, no matter which one you end up picking. I get why shell is "scripting of last resort", I regularly write shell scripts myself. I don't get why people would choose it over anything else where choices are available.
- fbdab103 4y ago>putting files names "$HOME" and similar in his home directory If you do this, the fallout is on you. Does he also make files called `~`?
- Kwpolska 4y agoThe backup script's job is to back up all files, not crash fatally because someone used a dollar sign, a tilde, or a space, or `rm -rf` in a file name. The sysadmin’s job is to write robust tools, not expect users to understand arcane UNIX stuff.
- fbdab103 4y agoYou are right of course. Just my knee jerk reaction that if someone is deliberately creating such files, they know exactly how much peril they are creating for themselves. Owing to so many years on the terminal, I still hesitate to name files with a space - a practice which the uninitiated find odd.
- lmz 4y agoThis would be considered silly if a web dev said this about e.g. a script breaking because someone entered a single quote into a text field and it was interpolated directly into an SQL statement. We should not tolerate this from sysadmins either.
- IshKebab 4y agoRight, it is unwise to do that precisely because there are so many shitty bash scripts in modern systems. I think the point was he was trying to find those shitty bash scripts - and ideally get them changed into something more robust (essentially anything else).