5 ms·
> The entire Debian/Ubuntu family has chosen the Almquist shell because of speed and standards compliance, and many things in this book will not work there. So
by BossingAround 4y ago
> The entire Debian/Ubuntu family has chosen the Almquist shell because of speed and standards compliance, and many things in this book will not work there.
So Debian/Ubuntu ship completely without Bash? According to [1], it's Bash, but it might be outdated.
[1] https://wiki.debian.org/Bash https://wiki.debian.org/Bash
- chasil 4y agoBash is shipped in Debian/Ubuntu, but as /bin/bash, not as /bin/sh. What is shipped as /bin/sh is described here: http://gondor.apana.org.au/~herbert/dash/ http://gondor.apana.org.au/~herbert/dash/ From the EPEL RPM: "DASH is a POSIX-compliant implementation of /bin/sh that aims to be as small as possible. It does this without sacrificing speed where possible. In fact, it is significantly faster than bash (the GNU Bourne-Again SHell) for most tasks."
- John23832 4y agoHm but the default shell is still bash. It would make sense that "bashisms" don't work on "sh". You should use bash or bash derivatives (zsh) for bashisms. I think the bigger stumbling block is that people often can't differentiate bashisms from basic shell scripting.
- gdavisson 4y agobash is the default interactive shell for users, but dash is the default shell for scripts with a #!/bin/sh shebang (or no shebang, unless they're run from bash), system() calls, etc. This means bashisms will work sometimes, which can be worse than not working at all. I agree about the importance of differentiating bashisms from basic scripting, but I think the root cause of that is documentation (including this book) that don't make the distinction.
- layer8 4y agoThe book is very clear about the fact that it’s using Bash, even noting when a feature requires a newer version, and uses #!/bin/bash for scripts throughout.
- John23832 4y ago...But the foreword for any script could just as easily be `#!/bin/bash`... you're choosing not to use bash. If you're on a system with no bash, and are forced to use `sh`, then just don't use bashisms... I'm not trying to be difficult, but I just don't see a problem. Explicitly use bash (or a derivative) if you want bashisms, don't if you do not.
- quesera 4y agoFWIW, zsh is not a bash derivative. Both are spiritual descendants of Bourne shell directly, with some ksh, csh, and tcsh mixed in, in varying proportions.