Andy Wingo <wi...@pobox.com> writes:
> The difference seems to be the difference between:
>
>   dash -c 'exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; read'
>
> and
>
>   bash -c 'exec 1>/dev/null; echo closed 1>&2; exec 2>/dev/null; read'
>
> Dash prints "closed" and exits immediately with error code 2.  Bash
> prints "closed" and waits for input from the "read".
>
> Are we relying on non-portable shell behavior here?

In dash, "read" requires at least one argument: the name of the variable
in which to put the string.  You don't see the error message because
stderr has been redirected to /dev/null.  In bash, the REPLY variable is
used by default.  So the "read" above ought to be changed to
"read REPLY".

    Best,
     Mark

Reply via email to