bug-bash
[Top][All Lists]
Advanced

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

Sourcing shopt setting removes 'history' from SHELLOPTS


From: Freddy Vulto
Subject: Sourcing shopt setting removes 'history' from SHELLOPTS
Date: Mon, 14 Sep 2009 22:06:45 +0200

Configuration Information [Automatically generated, do not change]:
Machine: i486
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i486'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i486-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H   -I.  -I../bash -I../bash/include
-I../bash/lib   -g -O2 -Wall
uname output: Linux myhost 2.6.26-2-686 #1 SMP Wed Aug 19 06:06:52
UTC 2009 i686 GNU/Linux
Machine Type: i486-pc-linux-gnu

Bash Version: 3.2
Patch Level: 39
Release Status: release

Description:
Sourcing or eval'ing code which touches a shopt setting, causes
`history' to disappear from the SHELLOPTS environment variable.

Repeat-By:

    $ # Make sure 'history' is on, and 'verbose' is off
    $ set -o history +o verbose
    $ echo $SHELLOPTS
    braceexpand:histexpand:history:interactive-comments:monitor:vi
    $ eval set +o verbose
    $ echo $SHELLOPTS  # 'history' is now gone
    braceexpand:histexpand:interactive-comments:monitor:vi

The same happens if you source a file (e.g. t.sh) with just one
command (e.g. set -o nounset):

    $ set -o history
    $ echo $SHELLOPTS
    braceexpand:histexpand:history:interactive-comments:monitor:vi
    $ cat t.sh
    set -o nounset
    $ source t.sh
    $ echo $SHELLOPTS  # 'history' is now gone
    braceexpand:histexpand:interactive-comments:monitor:nounset:vi

It doesn't occur if the shopt setting is touched directly (without
source or eval):

    $ # Make sure 'history' is on, and 'verbose' is off
    $ set -o history +o verbose
    $ echo $SHELLOPTS
    braceexpand:histexpand:history:interactive-comments:monitor:vi
    $ set +o verbose
    $ echo $SHELLOPTS  # 'history' is still there
    braceexpand:histexpand:history:interactive-comments:monitor:vi


Regards,

Freddy Vulto
http://fvue.nl




reply via email to

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