help-bash
[Top][All Lists]
Advanced

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

Bug of declare -p or exported variable?


From: Peng Yu
Subject: Bug of declare -p or exported variable?
Date: Mon, 5 Apr 2021 10:01:17 -0500

Hi,

As shown below, an exported variable is shown as `declare -x ...` by
`declare -p`. but `declare -x` and `export` are not the same when they
are used in a function. Is this a bug of `declare -p`? Thanks.

$ export PPP=888; declare -p PPP
declare -x PPP="888"
$ function f { declare -x XXX=abc; }; f; declare -p XXX
-bash: declare: XXX: not found
$ function g { export YYY=xyz; }; g; declare -p YYY
declare -x YYY="xyz"

-- 
Regards,
Peng



reply via email to

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