Discussion:
[Help-bash] Why `` in PS4='``' is reduced to empty string?
Peng Yu
2017-12-10 02:56:32 UTC
Permalink
Hi,

It seems that PS4 is interpreted. But this seems not documented.

Also, is it better to perserve PS4 literally without any inpretation?

$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

PS4='*' ./run.sh
PS4=\` ./run.sh
PS4='``' ./run.sh

$ cat run.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

set -x
./script.sh
$ ./main.sh
*./script.sh
`./script.sh
./script.sh
--
Regards,
Peng
Pierre Gaston
2017-12-10 06:14:40 UTC
Permalink
Post by Peng Yu
Hi,
It seems that PS4 is interpreted. But this seems not documented.
It is documented, it says it is expanded like PS1 and then under PROMPTING
it says it undergoes command substitution.
Post by Peng Yu
Also, is it better to perserve PS4 literally without any inpretation?
Using variables, eg LINENO or running commands, eg to display the date, can
be useful,

Loading...