I'm having some troubled time trying to figure out how to turn on the
xpg_echo option of the bash for every shell that will get run on my Linux RedHat system (7.4).
I know I can have what I need (the purpose is to expands backslash-escape at anytime as all the shells are ported from an HP-UX server) by using
shopt -s xpg_echo, it's working fine for most cases.
Now my problem is where to turn on this option "system-wide" or "globally" so that every shell that I will run uses it.
I tried putting
shopt -s xpg_echo into one custom shell in
It's working fine for:
- Interactive shell sessions (get's sourced from
- Login shell sessions (get's sourced from
- shell programs without a bash shebang (that is no
#!/bin/bashon 1st row)
but I can't get it to work in following cases, as it seems the
/etc/profile.d/ scripts don't get sourced and the
xpg_echo option is not inherited from the calling shell:
- when running a shell script (with for example
echo "a\tb") as a
- when running a shell script that has the bash shebang (
#!/bin/bash) on 1st row
I'd like to know if there is any way to turn on the shell option
xpg_echo for every conditions where I need to run a shell.
NB: I'm using GNU bash, version 4.2.46