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


Groups > gnu.bash.bug > #14733

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

Path csiph.com!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail
From Greg Wooledge <wooledg@eeg.ccf.org>
Newsgroups gnu.bash.bug
Subject Re: Environment variable "PS4" can not be passed to bash script from version 4.2.46(2)
Date Tue, 23 Oct 2018 12:06:06 -0400
Lines 19
Approved bug-bash@gnu.org
Message-ID <mailman.2626.1540310808.1284.bug-bash@gnu.org> (permalink)
References <1B925CC0CD9F3341B32D442251E7E1DC392DBFC8@shsmsx102.ccr.corp.intel.com>
NNTP-Posting-Host lists.gnu.org
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Trace usenet.stanford.edu 1540310808 20713 208.118.235.17 (23 Oct 2018 16:06:48 GMT)
X-Complaints-To action@cs.stanford.edu
Cc "bug-bash@gnu.org" <bug-bash@gnu.org>
To "Chen, Farrah" <farrah.chen@intel.com>
Envelope-to bug-bash@gnu.org
Mail-Followup-To "Chen, Farrah" <farrah.chen@intel.com>, "bug-bash@gnu.org" <bug-bash@gnu.org>
Content-Disposition inline
In-Reply-To <1B925CC0CD9F3341B32D442251E7E1DC392DBFC8@shsmsx102.ccr.corp.intel.com>
User-Agent NeoMutt/20170113 (1.7.2)
X-detected-operating-system by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From 139.137.100.1
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:14733

Show key headers only | View raw


On Tue, Oct 23, 2018 at 03:20:12PM +0000, Chen, Farrah wrote:
> But in Bash script, it cannot work, it keeps its original value:
> [root@fchen ~]# cat test.sh
> #!/usr/bin/bash
> echo $PS4
> echo $FAN

This is because you're doing it as root.  Bash strips PS4 from the
environment when started as root, as a security precaution.

wooledg:~$ PS4='hello' bash -c 'set -x; true'
hellotrue
wooledg:~$ sudo env PS4='hello' bash -c 'set -x; true'
[sudo] password for wooledg: 
+ true

Notice how it works as expected as a regular user, then "fails"
under sudo.

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


Thread

Re: Environment variable "PS4" can not be passed to bash script from version 4.2.46(2) Greg Wooledge <wooledg@eeg.ccf.org> - 2018-10-23 12:06 -0400

csiph-web