[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug of declare -p or exported variable?
From: |
Peng Yu |
Subject: |
Re: Bug of declare -p or exported variable? |
Date: |
Mon, 5 Apr 2021 10:29:09 -0500 |
My point is declare -p PPP should not be `declare -x PPP="888"`. It
should be `export PPP=888` as export is not the same as `declare -x`.
Whether `export` is the same as `declare -gx` is another question.
But is `export` actually the same as `declare -gx` instead?
On Mon, Apr 5, 2021 at 10:07 AM Marco Ippolito <maroloccio@gmail.com> wrote:
>
> > $ 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"
>
> f() { declare -gx A=b; }; f; declare -p A
> declare -x A="b"
--
Regards,
Peng