Hello.
Is there any book I can buy about dash shell?
I have a couple books on bash shell, but cannot find any about dash shell.
Or at least a book about strict POSIX shell programming without any features unique to bash, ksh, zsh.
Thank you for the answers.
Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Book about dash shell
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Book about dash shell
The Open Group publishes a nice usage guide for POSIX sh:
https://pubs.opengroup.org/onlinepubs/9 ... hap02.html
And I like these guides:
https://www.grymoire.com/Unix/Sh.html
https://drewdevault.com/2018/02/05/Intr ... shell.html
POSIX sh ftw!
EDIT: Greg's Wiki has a page that covers the differences between bash & POSIX sh:
https://mywiki.wooledge.org/Bashism
https://pubs.opengroup.org/onlinepubs/9 ... hap02.html
And I like these guides:
https://www.grymoire.com/Unix/Sh.html
https://drewdevault.com/2018/02/05/Intr ... shell.html
POSIX sh ftw!
EDIT: Greg's Wiki has a page that covers the differences between bash & POSIX sh:
https://mywiki.wooledge.org/Bashism
deadbang
-
- Global Moderator
- Posts: 3049
- Joined: 2017-09-17 07:12
- Has thanked: 5 times
- Been thanked: 132 times
Re: Book about dash shell
I find dash(1) man page quite comprehensive.
Personal observation: the implementation of the 'echo' builtin in dash is quite different from other common shells such as bash or busybox ash or the standalone 'echo' command from coreutils. It does not support -e|-E and behaves like others with -e. It seem that 'echo' is not strictly specified by POSIX. If consistent behaviour is needed with different shells, it is better to use 'printf' instead.
Personal observation: the implementation of the 'echo' builtin in dash is quite different from other common shells such as bash or busybox ash or the standalone 'echo' command from coreutils. It does not support -e|-E and behaves like others with -e. It seem that 'echo' is not strictly specified by POSIX. If consistent behaviour is needed with different shells, it is better to use 'printf' instead.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Book about dash shell
The only recognised option is -n and that is only specified for XSI-conformant systems.
I sometimes use this in scripts:Application Usage wrote:It is not possible to use echo portably across all POSIX systems unless both -n (as the first argument) and escape sequences are omitted.
The printf utility can be used portably to emulate any of the traditional behaviors of the echo utility
Code: Select all
echo () { printf %s\\n "$*" ; }
@LinuxOS, be sure to pass your scripts through checkbashims(1) (from the devscripts package) and https://www.shellcheck.net/ (there is a package but it's Haskell-based and regularly updated so the web interface is probably better).
deadbang
Re: Book about dash shell
Thank you for the answers.
Reading a page at this link https://www.etalabs.net/sh_tricks.html I found an opinion that "Bourne-derived languages are extremely bad, on the same order of badness as Perl" with the link https://www.etalabs.net/erik-perl.txt explaining how bad Perl language is. I always thought that Perl is one of the most robust languages and is used in mission-critical systems.
Reading a page at this link https://www.etalabs.net/sh_tricks.html I found an opinion that "Bourne-derived languages are extremely bad, on the same order of badness as Perl" with the link https://www.etalabs.net/erik-perl.txt explaining how bad Perl language is. I always thought that Perl is one of the most robust languages and is used in mission-critical systems.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 132 times
Re: Book about dash shell
I can't comment on Perl, I've never actually used it.
OpenBSD uses it for their package manager though:
https://github.com/openbsd/src/blob/mas ... pkg_add#L1
So it can't be that bad. EDIT: although it is criminally slow
OpenBSD uses it for their package manager though:
https://github.com/openbsd/src/blob/mas ... pkg_add#L1
So it can't be that bad. EDIT: although it is criminally slow
deadbang
Re: Book about dash shell
When dash was new, I saw a one page maybe pdf-document, where differences to bash were explained. I had to minor modifications to my scripts.
Have you tried bash vs dash net search?
Have you tried bash vs dash net search?
Re: Book about dash shell
You might want to consider The Linux programming interface from Michael Kerrisk. This book contains multiple chapters about POSIX