4 ms·
Debian dash can be compiled with editing modes for vi and emacs. There is great love from many for more capable shells, but the flaws of these are visible to a
by chasil 5y ago
Debian dash can be compiled with editing modes for vi and emacs.
There is great love from many for more capable shells, but the flaws of these are visible to all; "man bash" plainly states that it's "too big and too slow."
Minimal dash compiles to under 80k for i686, and Arch Linux asserts it to be 4x faster than bash.
It is with some regret that we did not adopt a shell syntax that could be cleanly LR-parsed with yacc and lex, but that was the fault of the founders.
Bill Joy has admitted his own flaws in the C shell, and Brian Kernigan should have torn that code apart, replacing it with awk syntax upon a shell. In a parallel world, it would have been a much more capable shell.
As things stand, we must struggle with the Algol of our forbearers, that requires an extremely advanced parser, and to make due with what is permitted to us.
https://m.youtube.com/watch?v=fiJR4_059HA https://m.youtube.com/watch?v=fiJR4_059HA
- chasil 5y agoThe author of the musl C library has this to say about the POSIX shell: "I am a strong believer that Bourne-derived languages are extremely bad, on the same order of badness as Perl, for programming, and consider programming sh for any purpose other than as a super-portable, lowest-common-denominator platform for build or bootstrap scripts and the like, as an extremely misguided endeavor." https://www.etalabs.net/sh_tricks.html https://www.etalabs.net/sh_tricks.html
- mro_name 5y ago> super-portable what else may come in mind to use?
- opk 5y agoThe basic unit on which shell scripts build is external commands. If what you want to do is to tie a few together, it is by far the best tool. For the type of programming problem where you need data structures it is indeed awful. But things like Python are really quite poor when it comes to executing external commands. You either need a dozen lines for each external command or things are done in a crap way with commands running synchronously when they don't need to be. With many real languages, people use a `system()` function that is running sh every time along with evaluation because the alternative is fork/exec/wait etc. Many of those sh tricks you link to are better even in the common ksh/bash/zsh subset than in pure POSIX.
- chasil 5y agoMy point is that the shell would be a much better tool if the language could be expressed with a simple, LR-parsed yacc grammar. Because the shell needs such an advanced parser, it shows that the language is full of ambiguity and pitfalls. The slides for the parent presentation have this gem: Quiz: Which is the command that outputs \\ ? 1 echo "\\\" 2 echo "\\\\" 3 echo "\\\\\\" The language should be clearer, and less ambiguous.