Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bash shopt xpg_echo

Tags:

bash

echo

shopt

I don't understand what the shopt xpg_echo changes if it is activated or deactivated.

In the manual:

xpg_echo
         If  set,  the  echo  builtin  expands   backslash-escape
         sequences by default.

I tried to activate/deactivate xpg_echo, but echo has the same behaviour.

like image 472
user1845784 Avatar asked Jan 19 '26 12:01

user1845784


1 Answers

It determines if echo will process escape-sequences like \n:

$ shopt -u xpg_echo # Disable xpg_echo
$ echo "Hello\nworld"
Hello\nworld
$ shopt -s xpg_echo # Enable xpg_echo
$ echo "Hello\nworld"
Hello
world
like image 183
mgarciaisaia Avatar answered Jan 21 '26 05:01

mgarciaisaia



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!