[Toybox] Would someone please explain what bash is doing here?
Chet Ramey
chet.ramey at case.edu
Fri Mar 13 11:42:11 PDT 2020
On 3/13/20 12:25 PM, Rob Landley wrote:
>> The dash folks would say so.
>
> Uh-huh. So it's a _choice_ that "dash /usr/bin" exits with 0
Yes. Most of the ash derivatives (dash, netbsd sh, freebsd sh, etc.)
exit with 0 in that case -- none have ever implemented binary file
checking, or check that the file is a regular file, though the netbsd
sh checks for an ELF magic number in a regular file. So it tries to read
the directory, gets EOF, and bails. The 0 is the last command's exit
status.
, as does
> dash -c 'echo hello;}' (14 years after ubuntu's /bin/sh)?
?
$ dash -c 'echo hello;}' ; echo $?
dash: 1: Syntax error: "}" unexpected
2
> I repeat, dash can go hang. Implementation quality aside, I disagree with their
> objectives and design goals.
OK, that's definitely valid.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet at case.edu http://tiswww.cwru.edu/~chet/
More information about the Toybox
mailing list