Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14732

Environment variable "PS4" can not be passed to bash script from version 4.2.46(2)

Path csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail
From "Chen, Farrah" <farrah.chen@intel.com>
Newsgroups gnu.bash.bug
Subject Environment variable "PS4" can not be passed to bash script from version 4.2.46(2)
Date Tue, 23 Oct 2018 15:20:12 +0000
Lines 55
Approved bug-bash@gnu.org
Message-ID <mailman.2624.1540309964.1284.bug-bash@gnu.org> (permalink)
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset="us-ascii"
Content-Transfer-Encoding quoted-printable
X-Trace usenet.stanford.edu 1540309966 20228 208.118.235.17 (23 Oct 2018 15:52:46 GMT)
X-Complaints-To action@cs.stanford.edu
To "bug-bash@gnu.org" <bug-bash@gnu.org>
Envelope-to bug-bash@gnu.org
X-Amp-Result SKIPPED(no attachment in message)
X-Amp-File-Uploaded False
X-ExtLoop1 1
X-IronPort-AV E=Sophos;i="5.54,416,1534834800"; d="scan'208,217";a="83502358"
Thread-Topic Environment variable "PS4" can not be passed to bash script from version 4.2.46(2)
Thread-Index AdRq3w9sHa2wWnCqS0C6/Wmnksx+SA==
Accept-Language en-US
Content-Language en-US
X-MS-Has-Attach
X-MS-TNEF-Correlator
dlp-product dlpe-windows
dlp-version 11.0.400.15
dlp-reaction no-action
x-titus-metadata-40 eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiNzMyYWI0MmYtYzc1Ni00OWJlLWFkYTMtM2UzODI2MGYyMGEwIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiR1wvYVp2bnhNZzRUUHJXd25CcG5VU2NadENEdEZFRWJpREZ4cmhoRzYreG5SQ1hYaktvRVZcLzhXV3Y3VU5DXC95MCJ9
x-ctpclassification CTP_NT
x-originating-ip [10.239.127.40]
X-detected-operating-system by eggs.gnu.org: Genre and OS details not recognized.
X-Received-From 192.55.52.115
X-Mailman-Approved-At Tue, 23 Oct 2018 11:52:43 -0400
X-Content-Filtered-By Mailman/MimeDel 2.1.21
X-BeenThere bug-bash@gnu.org
X-Mailman-Version 2.1.21
Precedence list
List-Id Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org>
List-Unsubscribe <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe>
List-Archive <http://lists.gnu.org/archive/html/bug-bash/>
List-Post <mailto:bug-bash@gnu.org>
List-Help <mailto:bug-bash-request@gnu.org?subject=help>
List-Subscribe <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe>
Xref csiph.com gnu.bash.bug:14732

Show key headers only | View raw


Hello,

I found a strange phenomenon, just as the subject, environment variable "PS4" cannot be passed to bash script, but any other variable, even self-defined variable can be passed to bash script.
My bash version is "GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)", I downloaded an old version bash-2.0.tar.gz from ftp://ftp.gnu.org/gnu/bash/ and installed, no such issue found, "PS4" works well.

I tried to set PS4 in /etc/profile, in /etc/bashrc, and export PS4 in terminal, just like below, it is correct in current terminal, but cannot be passed to bash script.

export PS4='+[#$LINENO ${FUNCNAME[0]}() $BASH_SOURCE] '
export FAN='Myself'

Then source /etc/profile, /etc/bashrc, I also tried to reboot my machine.
In terminal, it works well:

[root@fchen ~]# echo $PS4
+[#$LINENO ${FUNCNAME[0]}() $BASH_SOURCE]
[root@fchen ~]# echo $FAN
Myself

But in Bash script, it cannot work, it keeps its original value:
[root@fchen ~]# cat test.sh
#!/usr/bin/bash
echo $PS4
echo $FAN

[root@fchen ~]# bash test.sh
bash test.sh
+
Myself

Value of variable "Fan" I set in /etc/profile is correct, but $PS4 keeps its original value.
I tried many different variable names, such as "PS3", "PS5", all of them work, except "PS4".

I found such problem when we update our os from Red-hat 7.3 to Red-hat 7.4,this is a long time ago.
Now, I know that on Red-Hat7.0, bash version 4.2.45(1)-release, no such problem; on Red-hat 7.5 bash version 4.2.46(2)-release, on Ubuntu 16.04 bash version 4.3.48(1)-release, both have this issue.
I assume this issue occurs after version 4.2.46.
PS4 is used by "set -x" to prefix tracing output, it is very useful for our work, but it doesn't work now, I'm confused.

Thanks a lot.


Thanks,
Fan

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Environment variable "PS4" can not be passed to bash script from version 4.2.46(2) "Chen, Farrah" <farrah.chen@intel.com> - 2018-10-23 15:20 +0000

csiph-web