Hi Andreas,

Andreas Kusalananda wrote on Wed, Jan 29, 2020 at 06:09:54PM +0100:
> On Wed, Jan 29, 2020 at 05:48:44PM +0100, Ingo Schwarze wrote:

>> +.Dl du -sh * .??* | sort -h

> Why the ".??*"? That would miss single (well, double) letter hidden
> directory names like .a, .b etc.

True, but those are very uncommon in practice.
This is not supposed to be something that is perfect for each
and every occasion, but just an example that is easy to type
in interactive use and usually good enough.  Also, it is quite
obvious that .??* won't match ".a".

> As far as I know, neither ksh(1) nor sh(1) expands .* to ..
> (which I assume the ?? in .??* is a precaution against).

I have no intention of ensnaring users of other shells:

   $ uname -a
  OpenBSD isnote.usta.de 6.6 GENERIC.MP#583 amd64
   $ csh -c 'echo .*'
  . ..

   $ uname -a
  Linux donnerwolke.asta.kit.edu 4.9.0-0.bpo.3-686 #1 SMP Debian [...]
   $ dash -c 'echo .*'
  . ..
   $ bash -c 'echo .*'
  . ..

   > uname -a
  SunOS unstable11s 5.11 11.3 sun4u sparc SUNW,SPARC-Enterprise
   > /bin/sh -c 'echo .*'
  . ..
   > /bin/bash -c 'echo .*'
  . ..
   > /bin/csh -c 'echo .*'
  . ..
   > /bin/ksh -c 'echo .*'
  . ..
   > /bin/ksh93 -c 'echo .*'
  . ..
   > /bin/zsh -c 'echo .*' ; echo $?
  zsh:1: no match
  1
   > /bin/jsh -c 'echo .*'
  . ..
   > /usr/xpg4/bin/sh -c 'echo .*'
  . ..
   > /opt/csw/bin/tcsh -c 'echo .*'
  . ..

While keeping examples simple is nice, avoiding the most glaring
traps in examples is also a good idea unless it causes substantial
complication.

Yours,
  Ingo

Reply via email to