Score:0

Is there a way to set PS4 globally?

in flag

I'm testing an elaborate build system which executes a bunch of scripts as the root user with xtrace on (set -x). I do get the debug output that starts with one or more +s, but I would also like to log the file and line number which produced the output. I can set PS4 manually on the files that I'm sure will be executed, and that's what I'm doing right now.

export PS4='\033[0;33m+(${BASH_SOURCE}:${LINENO})\033[0m '

But there are several instances where I see a line starting with + instead of my custom set PS4. I am aware that due to CVE-2016-7543 bash no longer supports exporting PS4, so I'm curious to know where does bash set the PS4 variable, and if it's possible to change it globally.

EDIT: Upon further inspection I see that the change was introduced in the source code here. It's baked into bash so I guess the only workaround is to recompile bash :(

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.