Bash shopt xpg_echo
我不明白shoptBash shopt xpg_echo,bash,echo,shopt,Bash,Echo,Shopt,我不明白shoptxpg\u echo在激活或停用时会发生什么变化 在手册中: xpg_echo If set, the echo builtin expands backslash-escape sequences by default. 我试图激活/停用xpg_echo,但echo具有相同的行为。它确定echo是否将处理转义序列,如\n: $ shopt -u xpg_echo # Disable xpg_echo $ echo "Hell
xpg\u echo
在激活或停用时会发生什么变化
在手册中:
xpg_echo
If set, the echo builtin expands backslash-escape
sequences by default.
我试图激活/停用xpg_echo,但echo具有相同的行为。它确定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
这只是行为的一半;通过同时设置
posix
标志,它还使bash符合echo
标准的字母,从而在运行echo-e
时在输出上打印-e
。请参阅(确保不要忽略应用程序使用部分)。