bin/bash shell 换行失败

1

dash中

echo 'hello
world'

将会输出

hello
world

2

bash中

echo 'hello
world'

将会输出

hello
world

一般情况下 /bin/sh 被软链到 /bin/dash,偶尔也会遇到有人把 /bin/sh 软链到 /bin/bash。就会出现结果与预期不符的情况。

/bin/echo -e 'hello
world'

可以解决上述问题

bash支持的语法更多,建议用bash。dash更轻量级。

原文地址:https://www.cnblogs.com/jiqing9006/p/13083280.html