bug-bash
[Top][All Lists]
Advanced

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

"typeset +x var" to a variable exported to a function doesn't remove it


From: Dan Douglas
Subject: "typeset +x var" to a variable exported to a function doesn't remove it from the environment.
Date: Mon, 25 Mar 2013 20:37:09 -0500
User-agent: KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; )

Hello,

    $ function f { typeset +x x; typeset x=123; echo "$x"; sh -c 'echo "$x"'; 
}; x=abc f
    123
    abc
    $ echo "$BASH_VERSION"
    4.2.45(1)-release

This is inconsistent with a variable defined and exported any other way. 
(ksh93/mksh/zsh don't have this issue. Dash doesn't actually export the 
variable to the environment in this case, but just "localizes" it, and requires 
a separate export.)

-- 
Dan Douglas



reply via email to

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