4 ms·
> It would be helpful to have a book that is clear that the POSIX.2 shell is not Bash. Maybe the one thing I love about Linux culture (compared to the BSDs, il
by mustache_kimono 4y ago
> It would be helpful to have a book that is clear that the POSIX.2 shell is not Bash.
Maybe the one thing I love about Linux culture (compared to the BSDs, illumos, etc.) is that it generally doesn't require everyone to adhere to some high UNIX religion.
Writing a shell script of more than 50 lines is hard to do correctly. Bash sometimes makes that a little easier. And it's almost ubiquitous. Forcing new Linux users to learn a POSIX compliant shell, when they are only likely to be using Linux and bash, is simply cruel and unusual. Just as including only `vi` in the base system instead of `nano` is a silly self-own.
I see this unreflective question far too often: "Why aren't people using my system and using Linux instead?" And the answer is pretty simple, Linux at least made efforts to reach out to people where they were, in hundreds of low effort ways, whereas your system probably didn't.
"Everyone should be using Linux" and/or "should love the command line" is pretty silly, but just as silly is "people should learn the POSIX shell" first. A shell they are likely never to use interactively. Because of a hypothetical portability concern? It's nuts.
- tremon 4y agojust as silly is "people should learn the POSIX shell" first Where did the GP make that assertion? I don't see anywhere in the post where they say "please rewrite all the shell examples in POSIX-compliant sh". All I see is a request to inform the reader that not every shell is bash.
- chasil 4y agoThe origin of this was actually capitalism that bordered on religion. In the UNIX Wars of old, Sun and AT&T attempted to take unreasonable control of System V, which included the Korn shell. DEC, IBM, HP, and others responded with POSIX. https://en.wikipedia.org/wiki/Unix_wars https://en.wikipedia.org/wiki/Unix_wars The impact upon the Korn shall was actually to reduce functionality, and a number of features were removed (arrays, coprocesses, etc.). The reason for this is that the source code for the Korn shell was configured to compile to a 64k text segment (for 286-Xenix), and readability/maintainability was sacrificed. Due to this lineage of the POSIX shell, it is very friendly for embedded systems and other constrained environments in ways that its descendants and competitors are not (and can never be). It deserves to be distinguished from Bash, without question.
- mustache_kimono 4y ago> It deserves to be distinguished from Bash, without question. Absolutely, and I agree with your sentiment at a broad level -- although I think the book notes who the book is for, and that `bash` and `sh` are distinct, it doesn't explain the why of maybe considering `sh` for other uses which aren't really the focus of the book, and perhaps it should? > Due to this lineage of the POSIX shell, it is very friendly for embedded systems and other constrained environments I'm wondering if this will matter as much in the future. Are people really going to be programming 16 bit microcontrollers when a 32 bit parts are becoming so cheap? How constrained are we really going to be?
- chasil 4y agoHere is my copy of Busybox for Windows: C:\Users\chasil>busybox bash ~ $ a[1]=1 bash: a[1]=1: not found ~ $ Despite what Busybox claims, that is very much not Bash. That is Almquist, with a few added bashisms. I was in a clothing store a few months ago, and their credit card readers had crashed. They were showing the Busybox copyright notice.
- anthk 4y agoa[1]=1 $ echo $SHELL /bin/ksh This is mksh from MirBSD under Hyperbola Linux.
- cjsplat 4y agoA little revisionist since POSIX had its seeds in 1984, which was long before the SVR4 collaboration. Giving DEC, IBM, and HP credit for POSIX is a little odd. They were actually the biggest beneficiaries of the fragmented nature of Unix, with their proprietary flavors. AIX vs HPUX vs DEC Unix all meant that Ken Olsen could pretend to support Unix and at the same time tell the world that "Unix is snake oil".
- kccqzy 4y agoIn college during the introduction to command-line class the professor simply required everyone to write only POSIX-compliant shell scripts. And your shell scripts must work with newlines in file names. We did fun things like parsing (a subset of) HTML using only sed (did you know about sed's hold space and pattern space?). It was basically an intellectual puzzle for geeks with too much time on hand.
- bmn__ 4y ago> did you know about sed's hold space and pattern space? I did! https://perl.plover.com/yak/HoldSpace/ https://perl.plover.com/yak/HoldSpace/