shopt -s xpg_echo is not propagated anymore in subshell

Solution Verified - Updated -

Issue

  • When switching the bash option xpg_echo with shopt, a new script does not inherit of the setting.
  • For example:

    $ cat a.sh :
    shopt -s xpg_echo
    echo "\t 1st test"
    ./b.sh
    
    $ cat b.sh
    echo "\t 2nd test"
    
  • The output is:

             1st test
    \t 2nd test
    

=> in second script, \t is not interpreted as tabulation.

  • In RHEL 7, the echo of \t from second script is interpreted (if we add shopt -p xpg_echo, we ca see the value of the option):

             1st test
    shopt -s xpg_echo
             2nd test
    

Environment

  • Red Hat Enterprise Linux 8
  • bash 4.4

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content