小编Zer*_*uno的帖子

回显新行和以 \t 开头的字符串

当然,可以使用 echo -e 以便将 \n 理解为新行。问题是当我想回显以 \t 开头的内容时,例如“\test”。

假设我想表演echo -e "test\n\\test"。我期望输出:

test
\test
Run Code Online (Sandbox Code Playgroud)

但相反输出:

test
  est
Run Code Online (Sandbox Code Playgroud)

\\t解释为制表符而不是文字 \t。这个问题有一个干净的解决方法吗?

bash echo quoting

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

bash ×1

echo ×1

quoting ×1