dash 中bash
echo 'hello\nworld'
將會輸出ui
hello world
bash 中code
echo 'hello\nworld'
將會輸出nw
hello\nworld
通常狀況下 /bin/sh 被軟鏈到 /bin/dash,偶爾也會遇到有人把 /bin/sh 軟鏈到 /bin/bash。就會出現結果與預期不符的狀況。co
echo 在 dash 與 bash 中都是內建(builtin)的,使用外部命令 /bin/echo 能夠避免差別。
/bin/echo -e 'hello\nworld'
輸出
hello world