[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: -i option of set missing in man bash
From: |
Eduardo A . Bustamante López |
Subject: |
Re: -i option of set missing in man bash |
Date: |
Fri, 13 Mar 2015 18:47:02 -0600 |
User-agent: |
Mutt/1.5.23 (2014-03-12) |
> You can avoid these surprises by making -i just as other options, i.e.,
> working within the shell not just when a shell is started. [..]
I don't think it's good to have set +/-i available after initialization. It's
more complex to handle, and with little (or null?) gain. If you're using
set -i inside a script, then you're clearly doing it the wrong way (whatever
you're trying to achieve).
*But* I do think it's misleading to have bash accept the 'i' flag, but not
others. It also leads people to think that setting it from 'set' "worked",
because it's in $- "if it has an 'i' in $-, then it *must* be interactive,
right?", wrong.
Also, we're already disallowing the rest of the options already:
dualbus@hp:~$ bash -c 'for f in c i l r s D; do (set -$f; echo $-); done'
bash: line 0: set: -c: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
hiBc
bash: line 0: set: -l: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
hrBc
bash: line 0: set: -s: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
bash: line 0: set: -D: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
So, why not disallow 'i' also?
I propose the attached patch to deal with this (basically, it disallows setting
'i' with 'set').
Patched bash:
dualbus@hp:~$ ~/local/src/bash/bash -c 'for f in c i l r s D; do (set -$f; echo
$-); done'
/home/dualbus/local/src/bash/bash: line 0: set: -c: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
/home/dualbus/local/src/bash/bash: line 0: set: -i: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
/home/dualbus/local/src/bash/bash: line 0: set: -l: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
hrBc
/home/dualbus/local/src/bash/bash: line 0: set: -s: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
/home/dualbus/local/src/bash/bash: line 0: set: -D: invalid option
set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
hBc
--
Eduardo
set-i.patch
Description: Patch to disallow using set -i/set +i
- -i option of set missing in man bash, Peng Yu, 2015/03/11
- Re: -i option of set missing in man bash, Chet Ramey, 2015/03/12
- Re: -i option of set missing in man bash, Peng Yu, 2015/03/12
- Re: -i option of set missing in man bash, Chet Ramey, 2015/03/13
- Re: -i option of set missing in man bash, Peng Yu, 2015/03/13
- Re: -i option of set missing in man bash,
Eduardo A . Bustamante López <=
- Re: -i option of set missing in man bash, Chet Ramey, 2015/03/16
- Re: -i option of set missing in man bash, Eduardo A . Bustamante López, 2015/03/16
- Re: -i option of set missing in man bash, Chet Ramey, 2015/03/20