[sf-lug] glorious dash :-)

jim jim at well.com
Mon Aug 8 21:11:23 PDT 2016


(wild applause!!!)
Thank you!!!

PS : I changed the font throughout to fixed width (i.e.
monospace) to reveal the columnar nature of the shell's
interface, especially important for the readability of
the outputs of commands (e.g. see indentation below).

PPS : I love examples of shell commands, more thanks!!!


On 08/09/2016 03:25 AM, Michael Paoli wrote:
> Yes, dash (Debian Almquist shell) is rather glorious. :-)
>
> As I seem to recall it earlier described as a "minimally compliant POSIX
> shell".  Well, it may be a slight bit more/bigger than that, but not by
> much, and generally lacks most all the bloat (and bugs!) of bash.
>
> E.g. even just to reasonably describe them in their man pages:
>
> $ 2>>/dev/null man bash | col -b | expand | wc
>    5742   44536  339409
> $ 2>>/dev/null man dash | col -b | expand | wc
>    1590   10121   74074
> $
> So, we see a rather large size difference right there.
> And binaries?
> $ ls -Lno /bin/[bd]ash
> -rwxr-xr-x 1 0 1029624 Nov 12  2014 /bin/bash
> -rwxr-xr-x 1 0  125400 Nov  8  2014 /bin/dash
> $
> A quite significant size difference ... and that's not even getting into
> library dependencies.
> $ ldd /bin/bash /bin/dash
> /bin/bash:
>         linux-vdso.so.1 (0x00007ffd81581000)
>         libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 
> (0x00007f0637252000)
>         libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 
> (0x00007f0637028000)
>         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
> (0x00007f0636e24000)
>         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f0636a79000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f0637477000)
> /bin/dash:
>         linux-vdso.so.1 (0x00007ffe1497c000)
>         libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6f0c423000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f6f0c9ef000)
> Those used by dash, are also used by bash,
> but bash additionally uses these not used by dash:
>         libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 
> (0x00007f0637252000)
>         libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 
> (0x00007f0637028000)
>         libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 
> (0x00007f0636e24000)
> $ ls -Lno /lib/x86_64-linux-gnu/libncurses.so.5 \
>> lib/x86_64-linux-gnu/libtinfo.so.5 /lib/x86_64-linux-gnu/libdl.so.2
> -rw-r--r-- 1 0  14664 Feb 29 09:29 /lib/x86_64-linux-gnu/libdl.so.2
> -rw-r--r-- 1 0 151120 Dec  8  2014 /lib/x86_64-linux-gnu/libncurses.so.5
> -rw-r--r-- 1 0 171800 Dec  8  2014 /lib/x86_64-linux-gnu/libtinfo.so.5
>
> Oh, and bash - also has bugs not present in dash and (most) other
> shells:
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=86397
>
> If I'm writing a shell script, I generally prefer more standard,
> smaller, fewer bugs, and less likely to break now, or in future.  The
> dash shell is generally a much better fit for that than bash.  There's
> darn good reasion it's used for /bin/sh on, e.g. Debian:
> $ ls -on /bin/sh
> lrwxrwxrwx 1 0 4 Nov  8  2014 /bin/sh -> dash
> $ lsb_release -d
> Description:    Debian GNU/Linux 8.5 (jessie)
> $
> It's also the provided or default shell on many operating systems.
>
> references/excerpts:
> https://packages.debian.org/jessie/dash
> https://en.wikipedia.org/wiki/Almquist_shell
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=86397
> http://buug.org/pipermail/buug/2011-August/003862.html
> http://buug.org/pipermail/buug/2011-August/003866.html
> http://buug.org/pipermail/buug/2011-August/003869.html
> http://buug.org/pipermail/buug/2011-August/003871.html
>
>> From: "Alex Kleider" <akleider at sonic.net>
>> Subject: Re: [sf-lug] > and >> and < and << and |
>> Date: Mon, 08 Aug 2016 18:29:02 -0700
>
>> On 2016-08-08 10:32, jim wrote:
>>
>>> (The DASH man page is glorious, unlike some other
>>> man pages.)
>>
>> I've noticed that some small (SoC) systems come with dash rather than 
>> bash and assumed that the former was a 'smaller' version of the 
>> latter and was surprised that my system (current LTS of Ubuntu) seems 
>> to have both installed.
>> $ man DASH  # man page
>> $ man dash  # same man page
>> $ man bash  # different structure but I find no differences in 
>> behaviour described.
>> $ dash # => a '$' prompt by itself; I'm in another shell, dash this 
>> time.
>> $ DASH
>> DASH: command not found
>> $ bash  # a pause and then the same prompt returns; I'm in another 
>> shell.
>>
>> interesting.
>> Under what circumstances would someone with both installed wish to 
>> use dash rather than bash?
>
>
> _______________________________________________
> sf-lug mailing list
> sf-lug at linuxmafia.com
> http://linuxmafia.com/mailman/listinfo/sf-lug
> Information about SF-LUG is at http://www.sf-lug.org/
>





More information about the sf-lug mailing list