help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] Why bash has two sets of options (controlled by `set' an


From: Chet Ramey
Subject: Re: [Help-bash] Why bash has two sets of options (controlled by `set' and `shopt')
Date: Mon, 26 Oct 2015 13:44:41 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:38.0) Gecko/20100101 Thunderbird/38.3.0

On 10/26/15 1:14 PM, Stephane Chazelas wrote:

> So, is the rule:
> 
> an option is a set -o (SHELLOPTS) option as opposed to a shopt
> option (BASHOPTS) if it has a corresponding single-letter "set"
> option, or is in POSIX (ignoreeof, vi) or is also in ksh (emacs,
> pipefail, histexpand...)?

Kind of.  It's not a given that any particular -o option that ksh93 has
will be a -o option in bash.  Keep in mind that `emacs' was in drafts of
Posix until Stallman had it removed, and `histexpand' originated with
bash, has a single-letter set equivalent (set -H), and predates shopt.
I added pipefail in the hopes that Posix would standardize it -- Korn
requested that, as I recall.

> But then, what about login_shell and globstar which are in ksh
> but in BASHOPTS. And history, posix or interactive-comments that
> don't have single letter options, and are not in ksh or POSIX?

login_shell came to bash first, I think, and globstar was the kind
of thing that shopt was made for.  `history' came in at the same
time as shopt, but went into -o in the hope that Posix would use it,
if I am remembering 10-15 years ago correctly.  `posix' and
`interactive-comments' predate `shopt'.

So, it's an evolving rule, but you have to remember the history and
chronology.

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
                 ``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]