[sf-lug] dash ...: Re: SF-LUG meeting notes for Monday 15 April 2019

Michael Paoli Michael.Paoli at cal.berkeley.edu
Tue Apr 16 10:37:50 PDT 2019


dash ... it's essentially a minimally compliant POSIX shell.
Which also does make it pretty lean, clean, highly (backwards) compatible
(for the most part), etc.

It rather self-describes itself pretty well too:
$ echo $(lsb_release -d) $(uname -m)
Description: Debian GNU/Linux 9.8 (stretch) x86_64
$ apt-cache show dash
Package: dash
Version: 0.5.8-2.4
Essential: yes
Installed-Size: 204
Maintainer: Gerrit Pape <pape at smarden.org>
Architecture: amd64
Depends: debianutils (>= 2.15), dpkg (>= 1.15.0)
Pre-Depends: libc6 (>= 2.14)
Description-en: POSIX-compliant shell
  The Debian Almquist Shell (dash) is a POSIX-compliant shell derived
  from ash.
  .
  Since it executes scripts faster than bash, and has fewer library
  dependencies (making it more robust against software or hardware
  failures), it is used as the default system shell on Debian systems.
Description-md5: 8d4d9c32c6b2b70328f7f774a0cc1248
Homepage: http://gondor.apana.org.au/~herbert/dash/
Tag: implemented-in::c, interface::shell, role::program, scope::utility
Section: shells
Priority: required
Filename: pool/main/d/dash/dash_0.5.8-2.4_amd64.deb
Size: 108950
MD5sum: b7e39b719a561dbbd10076c30f9d7702
SHA256: 5084b7e30fde9c51c4312f4da45d4fdfb861ab91c1d514a164dcb8afd8612f65

$ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan 23  2017 /bin/sh -> dash
$

And yes, I'll often look at the dash page, rather than (egad) bash,
because most of the time I'm not using  or dependent upon some bashism,
and there's much less cruft/bloat/"bells and whistles"(/bugs/...) with
dash compared to bash.


Also, the "type" command is built-in to most non-ancient sh-type
shells, so I often use type rather than which - though also for many
such shells both do more-or-less about the same thing.

And /bin and/or /usr/bin (as applicable) will generally be on the PATH,
so typing the (intended) command - e.g. dash, or doing type dash or
which dash should suffice to see if it's installed already.  Looking with
ls is mostly unnecessary/redundant - unless permissions are messed up or
something highly atypical like that in there.

And yes, I quite like dash.
I typically script for POSIX compliant (that way, among other things,
it will generally not only work, but continue to work, and be much more
portable), and usually use /bin/sh - which on non-ancient systems should
generally give one a POSIX compliant shell - e.g. dash (or for many distros,
it invokes bash as sh or /bin/sh, in which case bash sees the base portion
of its arg0 as sh, and then tries to more-or-less behave in a POSIXly
way).  For interactive stuff though, at least on Linux, I'm typically
using bash, and for scripting, there are a *very* few bashisms I find
sufficiently useful sometimes I'll use bash instead, ... but otherwise
mostly code for POSIX/sh/dash.  And what few bashisms?  Besides interactive
stuff, redirection to/from in way that works like file (functions as
file argument), but is command, e.g.: <(some_command) >(some_other_command)
... is quite handy for stuff that requires some data from a "file" argument,
reads - or writes it - but doesn't seek on it, and can't do that
data from stdin or stdout.  So, that's probably about the only bashism I
wouldn't mind seeing POSIX pick up.  The rest of the bash stuff is
bells 'n whistles and stuff handy for interactive but really unneeded
for scripts - at least in my opinion.  :-)
There are of course ways to do that type of redirection without that bash
mechanism, but that then involves creating some (temporary) named pipes,
and removing them after ... which is more code ... but bash can do all
that for one with fairly straight-forward syntax.

> From: jim <jim at well.com>
> Subject: Re: [sf-lug] SF-LUG meeting notes for Monday 15 April 2019
> Date: Tue, 16 Apr 2019 02:03:16 -0400

>
> I prefer the dash shell mainly because of its man page
> $ man dash
> which is the best man page I have encountered.
> The dash man page is clearly written, and because
> the dash shell is lean, the man page has only to
> describe what is there, and that makes the dash
> man page a great introduction (for intermediate
> level readers) to shells in general. Compare the
> dash man page to the bash man page; it's kind of
> like comparing a portion of brocolli on a plate to a
> large salad spilt on a floor.
>
> What we did to try to find dash was
> $ which dash
> I could not read the screen (I was too far away and
> at a bad angle), but given what Bobbie reported,
> the which command did not return a path to a
> dash shell.
>
> We tried
> $ which bash
> and Bobbie reported that the which command
> returned  /bin/bash
>
> We did not think simply to peruse the output of
> $ ls /bin
> to see if  dash  is in the listing.
>
>
> I thought that Fedora used rpm (the redhat package
> manager). Is it really true that Fedora uses the  apt
> tools for package management??
>
>
> On 4/16/19 1:27 AM, Rick Moen wrote:
>> Quoting Bobbie Sellers (bliss-sf4ever at dslextreme.com):
>>
>>> AV Linux has a multitude of audio and video editing
>>> tools.
>> Sure.  It's a bundle of Debian Stable with multimedia packages from the
>> KXStudio repositories, and Debian's XFCE4 packages with some small
>> modifications.  So, _of course_ it has a multitude of AV tools, and
>> access to all the other ones in the Debian repo.
>>
>>> I don't think this is really a distro for a laptop even one with 8 GB
>>> but for 32 GB and i7 with 6 cores or the new AMD multicore CPUs it
>>> might blaze along.
>> Um, no.  Nonsense.
>>
>> Any reasonable and fairly recent x86_64 wtih 4GB RAM will do, and even a
>> maxed out i386 machine with 4GB would.  Part of the reason you tend to
>> get this wrong is that you keep trying to judge distributions based on
>> 'live' non-installed operation, which is for obvious reasons slower and
>> much more demanding of system resources including RAM.
>>
>> That's not to mention that, if one _did_ find an installed version to be
>> RAM-constrained, the obvious remedy would be to reconfigure to use
>> something more thrifty than XFCE4, and to spend some time paring down
>> unwanted startup processes.
>>
>>> It uses Synaptic for software
>> It uses apt/dpkg for software.  Synaptic is not a package manger; it's a
>> gtk front-end to a package manager.
>>
>>
>>> I also demoed the Fedora 30 beta with KDE for him and showed him the
>>> alternate menu styles available on KDE.  Jim was not happy with the
>>> terminal available preferring the Dash terminal.
>> Someone's probably confused, here.
>>
>> I'm guessing that Jim was unhappy with the Fedora 30 KDE (beta) spin's
>> default graphical terminal tool, which I'm guessing is Konsole.
>>
>> 'dash' is not a graphical terminal tool, but rather a shell,
>> specifically the Debian Almquist SHell (thus 'dash').  This in turn is a
>> Debian-centric variant of Kenneth Almquist's 'ash' shell, which is a
>> very lightweight Bourne compatible shell suitable for the superuser
>> account and for system scripting.  I would be enormously surprised if
>> Jim has a preference for dash/ash (or any other lightweight, minimalist
>> Unix shell), though if he says so, more power to him, I guess.  (It's
>> more likely he didn't like the graphical terminal app available by
>> default, not the shell.  Fedora's default shell is bash.)
>>
>> https://www.cyberciti.biz/faq/debian-ubuntu-linux-binbash-vs-bindash-vs-binshshell/
>>
>> If Jim's serious, then dash version 0.5.10.2 is packaged in Fedora as
>> package 'dash'.  I don't know what search you did exactly, but it's
>> right there to find.
>>
>> https://koji.fedoraproject.org/koji/buildinfo?buildID=1185464
>>
>>
>>> So I fired up the DNF Dragora update tool and did a search for it.  No
>>> Luck.  It is easy to get Fedora online.  DNF Dragora used a lot of CPU
>>> and time to give minimal results.
>> Feh.  Just use dnf.  Seriously, Bobbie.  This ain't brain surgery.
>>
>> $ dnf search dash




More information about the sf-lug mailing list