Stephane Chazelas <stephane.chaze...@gmail.com> wrote:

> 2018-04-27 20:28:57 +0200, Martijn Dekker:
> [...]
> > : <&8 || echo "oops, closed"
> [...]
>
> Remember ":" is a special builtin, so its failure causes the
> shell to exit. Another one of those accidents of implementation
> of the Bourne shell that ended up being specified by POSIX, but
> which makes little sense (but that other shells ended up
> implementing for conformance).

The background seems to be a bit more complex:

sh -c ' : <&8; echo bla' # Solaris 11 Bourne Shell
bla

osh -c ' : <&8; echo bla' # Schily Solaris 11 emulation
bla

ksh -c ' : <&8; echo bla'  # ksh88
ksh: 8: bad file unit number

bosh -c ' : <&8; echo bla'
bosh: 8: Falsche Dateinummer

bash -c ' : <&8; echo bla'
bash: 8: Falsche Dateinummer
bla

So:

1)      before POSIX, ":" could not fail

2)      bash ignores the "new" rules.

Jörg

-- 
 EMail:jo...@schily.net                    (home) Jörg Schilling D-13353 Berlin
    joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'

Reply via email to