1

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.

4

1 回答 1

3

它确定 echo 是否会处理转义序列,例如\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
于 2012-11-22T18:51:51.300 回答