teknopaul <teknop...@fastmail.es> writes:
> Hi not sure if this is the correct forum...

I believe this is the correct forum.

> exit builtin accepts one and only one arg currently.
>
> Would it be backwards compatible and generally useful to support
> echoing a reason for exiting?
>
> test -f file || exit 2 "file not found"

Well, you can get a similar effect tersely via

    test -f file || { echo "file not found"; exit 2; }

but you may want to say

    test -f file || { echo >&2 "file not found"; exit 2; }

And I think that may be the difficulty with making this an additional
function of "exit", there may well be too many variants in common use to
allow a simple extension to "exit" to cover the bulk of all uses.  And
again, the present alternative has few disadvantages.

Dale

Reply via email to