A NOTE has been added to this issue. 
====================================================================== 
http://austingroupbugs.net/view.php?id=1039 
====================================================================== 
Reported By:                kre
Assigned To:                
====================================================================== 
Project:                    1003.1(2013)/Issue7+TC1
Issue ID:                   1039
Category:                   Shell and Utilities
Type:                       Clarification Requested
Severity:                   Editorial
Priority:                   normal
Status:                     Interpretation Required
Name:                       Robert Elz 
Organization:                
User Reference:              
Section:                    2.5.2 
Page Number:                2324 
Line Number:                73759-73761 
Interp Status:              Pending 
Final Accepted Text:        http://austingroupbugs.net/view.php?id=1039#c3617 
====================================================================== 
Date Submitted:             2016-03-26 07:30 UTC
Last Modified:              2018-04-26 11:44 UTC
====================================================================== 
Summary:                    Which option flags should appear in $- ?
====================================================================== 

---------------------------------------------------------------------- 
 (0004002) McDutchie (reporter) - 2018-04-26 11:44
 http://austingroupbugs.net/view.php?id=1039#c4002 
---------------------------------------------------------------------- 
kre, I don't think you're going to get a guarantee that the 'set -$-'
workaround is a no-op, because in fact it fails on most current and
historical shells.

Historical:

$ sh -c 'set -$-'    # Bourne shell, Xenix (1988)
sh: -s: bad option(s)

$ sh -c 'set -$-'    # Bourne shell, Solaris 10.3 (2010)
sh: -s: bad option(s)

$ ksh -c 'set -$-'   # ksh88, Solaris 10.3 (2010)
ksh: -shc: bad option(s)

Presumably it works on the historical ash (Almquist shell) as it does on
all current derivatives, but I don't have any historical ash I can test.

Current:

$ ksh -c 'set -$-'   # ksh93
ksh: set: -c: unknown option
Usage: set [-sabefhkmnprtuvxBCGH] [-A name] [-o[option]] [arg ...]

$ ksh -c 'set -$-'   # NetBSD ksh (pdksh)
ksh: set: -c: unknown option
ksh: set: 

$ ksh -c 'set -$-'   # OpenBSD sh and ksh (pdksh)
ksh: set: -c: unknown option

$ mksh -c 'set -$-'
mksh: set: -c: unknown option

$ bash -c 'set -$-'
bash: line 0: set: -c: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]

$ yash -c 'set -$-'
set: the cmdline option cannot be changed once the shell has been
initialized

It only works on:

- NetBSD sh (of course)

- FreeBSD sh

- dash

- Busybox ash

- zsh

...so basically on Almquist derivatives plus zsh. That minority is nowhere
close to establishing de facto standard behaviour. 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-03-26 07:30 kre            New Issue                                    
2016-03-26 07:30 kre            Name                      => Robert Elz      
2016-03-26 07:30 kre            Section                   => 2.5.2           
2016-03-26 07:30 kre            Page Number               => unknown         
2016-03-26 07:30 kre            Line Number               => unknown         
2016-03-26 08:12 Don Cragun     Page Number              unknown => 2324     
2016-03-26 08:12 Don Cragun     Line Number              unknown => 73759-73761
2016-03-26 08:12 Don Cragun     Interp Status             => ---             
2017-03-16 16:22 geoffclare     Note Added: 0003617                          
2017-03-16 16:23 geoffclare     Interp Status            --- => Pending      
2017-03-16 16:23 geoffclare     Final Accepted Text       =>
http://austingroupbugs.net/view.php?id=1039#c3617    
2017-03-16 16:23 geoffclare     Status                   New => Interpretation
Required
2017-03-16 16:23 geoffclare     Resolution               Open => Accepted As
Marked
2017-03-16 16:23 geoffclare     Tag Attached: tc3-2008                       
2017-03-16 17:16 kre            Note Added: 0003618                          
2017-03-16 17:31 joerg          Note Added: 0003619                          
2017-03-16 17:38 joerg          Note Edited: 0003619                         
2017-03-16 18:07 kre            Note Added: 0003620                          
2017-03-17 09:09 geoffclare     Note Added: 0003622                          
2017-03-17 10:46 kre            Note Added: 0003624                          
2017-03-17 10:54 joerg          Note Added: 0003625                          
2017-03-17 12:07 kre            Note Added: 0003630                          
2017-03-17 12:51 joerg          Note Added: 0003634                          
2017-03-17 13:05 kre            Note Added: 0003636                          
2018-04-26 11:44 McDutchie      Note Added: 0004002                          
======================================================================


Reply via email to