Bash shopt xpg_echo

问题描述 投票:1回答:1

我不知道商店xpg_echo被激活或停用后会发生什么变化。

在手册中:

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

我试图激活/停用xpg_echo,但是echo具有相同的行为。

bash echo shopt
1个回答
2
投票

它确定回声是否会处理转义序列,例如\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
© www.soinside.com 2019 - 2024. All rights reserved.