5 ms·
So much arrogance and negativity, so little evidence for the claims you make. > A shell script has a very simple function: execute a number of tedious but comm
by effie 9y ago
So much arrogance and negativity, so little evidence for the claims you make.
> A shell script has a very simple function: execute a number of tedious but common commands. That's it.
And why is that? What will happen to me if I write more complicated shell scripts? The functionality is there and one can write very expressive and readable programs in shell. I would definitely recommend shell for writing long programs (for example various system administration and web backend tasks which do not require complex libraries). Preferably bash since it is the most common one.
> And somehow the entire Linux ecosystem depends on it and now every distro has to ship a shell with cruft dating back to 1970
The 'somehow' has quite a simple rationale, it isn't something that should outrage you. The family of Linux-based OSes take inspiration and compatibility target in unix systems on purpose. Unix systems are primarily operated via shell.
The current standard of shell may be an old idea from 70's with some 'cruft', but what language does not have cruft? The shell has proven to be usable and worthy of continued use. The compatibility with the unix shell is a big part of the early success of GNU/Linux and majority of users need it.
> And now every shell that tries to position itself on the market has to implement the same quirks, bugs, and design flaws in order to even be considered.
I have no idea what you are talking about.
> please use python or even perl for the love of god if you're going to make a build system
OK, so you think perl and python are better for making a build system. Have you made one?
- paulie_a 9y ago> What will happen to me if I write more complicated shell scripts? As part of my job currently, I am going to delete it. The same goes for poor python code, but I will take bad python over shell scripts any day of the week.
- AlexCoventry 9y ago> As part of my job currently, I am going to delete it. Go away, or I will turn you into a very small shell script. #!/bin/bash find / -name \*.sh -size +10k -type f -print0 | xargs -0 rm
- asfdsfggtfd 9y agoDoes this escape spaces in filenames properly?
- pvdebbe 9y agoFind's `-print0' will output results using null separation. Xargs' `-0' argument will treat input as null-separated.
- explainplease 9y ago$ mangle find -delete ACTIONS -delete Delete files; true if removal succeeded. If the removal failed, an error message is issued. If -delete fails, find's exit status will be nonzero (when it eventually exits). Use of -delete automatically turns on the -depth option. Warnings: Don't forget that the find command line is evaluated as an expression, so putting -delete first will make find try to delete everything below the starting points you specified. When testing a find command line that you later intend to use with -delete, you should explicitly specify -depth in order to avoid later surprises. Because -delete implies -depth, you cannot usefully use -prune and -delete together.
- aepiepaey 9y agoIs mangle an actual program that's publicly available? Searched for it but didn't find anything.
- explainplease 9y agohttps://github.com/alphapapa/mangle https://github.com/alphapapa/mangle
- AlexCoventry 9y agoThank you.
- stephenr 9y ago> bash since it is the most common one. Im pretty sure you meant to say "POSIX, because its rules are supported by multiple shells, and you can't depend on bash being available or a recent version on some systems".
- effie 9y agoActually, I meant bash, that is, if one works solely with Linux systems. Bash has some very useful features and is the default on common Linux systems. Those are not POSIX. It was frozen in time long ago and is very limiting, do not wear that straightjacket if you do not have to. For commercial unices or bsd's bash could be hard to use and using POSIX shell may make more sense.
- stephenr 9y agoFrom my experience, the extras Bash give you are likely to be bigger hints that it is time to move to a more appropriate language. I'm definitely pro on shell scripts, but I'm also willing to use a different language when posix SH isn't going to cut it.
- ams6110 9y agoAny unix system will have sh(1). Not all have bash. Not all have python. More probably have perl than python, so if you want something other than sh, then perl should probably be it.
- stephenr 9y agoI'm aware of that. When I said POSIX, I was referring to a POSIX-compatible sh implementation.
- sametmax 9y agoJust for the error handling and namespacing, python is more suited for big code bases. But there are way, way more reasons.