Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Chet Ramey
On 11/9/18 11:46 AM, Eric Blake wrote: > On 11/9/18 10:42 AM, Chet Ramey wrote: > >> >>> A diagnostic message shall be written to standard error whenever an >>> error condition occurs." >>> >>> Since 'shift 2' when $# is 1 is an error, and results in non-zero status, >>> it should print a

Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Eric Blake
On 11/9/18 10:42 AM, Chet Ramey wrote:     A diagnostic message shall be written to standard error whenever an error condition occurs." Since 'shift 2' when $# is 1 is an error, and results in non-zero status, it should print a diagnostic to stderr. So maybe the thing to do is to turn on

Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Chet Ramey
On 11/9/18 11:22 AM, Eric Blake wrote: > On 11/9/18 8:52 AM, Chet Ramey wrote: >> On 11/9/18 9:47 AM, Eric Blake wrote: >> >>> Well, there's STILL a conformance issue - the standard requires that unless >>> documented otherwise, any time a command line tool exits with non-zero >>> status, that it

Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Eric Blake
On 11/9/18 8:52 AM, Chet Ramey wrote: On 11/9/18 9:47 AM, Eric Blake wrote: Well, there's STILL a conformance issue - the standard requires that unless documented otherwise, any time a command line tool exits with non-zero status, that it outputs a message to stderr explaining the error.

Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Chet Ramey
On 11/9/18 9:47 AM, Eric Blake wrote: > Well, there's STILL a conformance issue - the standard requires that unless > documented otherwise, any time a command line tool exits with non-zero > status, that it outputs a message to stderr explaining the error.  Where? -- ``The lyf so short, the

Re: exiting noninteractive shells on 'shift 2'

2018-11-09 Thread Eric Blake
On 11/8/18 6:03 PM, Chet Ramey wrote: On 11/8/18 3:37 PM, Eric Blake wrote: If I'm reading POSIX correctly, shift is a special built-in utility, and if '$#' is 0 or 1, then 'shift 2' counts as a utility error that shall exit the shell, per the table in 2.8.1 Consequences of Shell Errors:

Re: exiting noninteractive shells on 'shift 2'

2018-11-08 Thread Grisha Levit
On Thu, Nov 8, 2018, 3:48 PM Eric Blake wrote: > If the n operand is invalid or is greater than "$#", this may be > considered a syntax error and a non-interactive shell may exit; if the > shell does not exit in this case, a non-zero exit status shall be > returned. This seems to say that

Re: exiting noninteractive shells on 'shift 2'

2018-11-08 Thread Chet Ramey
On 11/8/18 3:37 PM, Eric Blake wrote: > If I'm reading POSIX correctly, shift is a special built-in utility, and if > '$#' is 0 or 1, then 'shift 2' counts as a utility error that shall exit > the shell, per the table in 2.8.1 Consequences of Shell Errors: > >