Path: csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail From: "Chen, Farrah" 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: 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" 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com gnu.bash.bug:14732 Hello, I found a strange phenomenon, just as the subject, environment variable "PS= 4" cannot be passed to bash script, but any other variable, even self-defin= ed variable can be passed to bash script. My bash version is "GNU bash, version 4.2.46(2)-release (x86_64-redhat-linu= x-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 termi= nal, just like below, it is correct in current terminal, but cannot be pass= ed to bash script. export PS4=3D'+[#$LINENO ${FUNCNAME[0]}() $BASH_SOURCE] ' export FAN=3D'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 it= s original value. I tried many different variable names, such as "PS3", "PS5", all of them wo= rk, 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 pro= blem; on Red-hat 7.5 bash version 4.2.46(2)-release, on Ubuntu 16.04 bash v= ersion 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