3 ms·
>"for the type of task I would implement in a shell script" And therein lies the rub. Let's put the donkey before the cart: The reason you would not do many ki
by DonHopkins 8y ago
>"for the type of task I would implement in a shell script"
And therein lies the rub. Let's put the donkey before the cart: The reason you would not do many kinds of task in a shell script, is that shell scripts are not any good for many kinds of tasks, not because you are wrong to want to to some kinds of tasks.
The term "shell script" is an artificial construct, just like the shell scripting language itself. There is no reason you need to limit your imagination, aspirations and abilities by defining yourself as a "shell scripter" who cannot add 1.5 and 0.5 to get 2, and who cannot draw a pie chart.
Of course you should learn other languages, then you won't need to write shell scripts. Their disadvantages vastly outweigh their advantages in important ways specific to scripting and unix administration (like dealing with file names with spaces, or performing arithmetic and statistics, for examples).
- saagarjha 8y ago> shell scripts are not any good for many kinds of tasks Shell scripts are good for gluing together tools that do disparate things and simple automation. Most shell scripts end up becoming "real programs" once they start containing actual logic in them.
- naniwaduni 8y agoMore importantly, it doesn't matter that there are many kinds of tasks that shell scripts aren't good at. It matters that there are tasks that shell scripts are good at, and indeed better suited to than any popular general-purpose language. When you have a pipeline between two nontrivial programs, for example, or any kind of fd manipulation.
- DonHopkins 8y agoYet the problem remains that bash scripts are NOT actually good for what they're designed for: dealing with file names. Because some file names have spaces in them, and some file names begin with hyphens, and so many careless bash programmers don't give a shit, and would rather blame their audacious uncontrollable users for daring to put spaces or hyphens in their file names, than write scripts that don't suddenly and inexplicably crash, years after they're written and the programmer has long since left. Python and JavaScript are also good for gluing together tools that do disparate things and simple automation. But they can do arithmetic and graphics, too! And without the enormous overhead of forking a process to perform simple arithmetic and string manipulation. Bash scripts aren't good for many useful tasks because bash is badly designed, not because there's some universal law of computing that proclaims that scripts should never use floating point numbers or draw graphics. Apple figured all this out in 1979 when they made a deal with Microsoft and switched from INTEGER BASIC to APPLESOFT BASIC, and added floating point and HIRES graphics. Even Apple ][ DOS 3.2 could deal with file names with spaces in them! How long will it take the Unix community to figure that out, too? https://www.youtube.com/watch?v=RiWE-aO-cyU https://www.youtube.com/watch?v=RiWE-aO-cyU