我努力做到以下幾點:「回聲-e」蘇-c命令不工作
su username -c "echo -e "test 1""
當我這樣做,它輸出:
-e test
如果我試試這個:
su username -c "echo -e 'test 1'"
輸出:
-e test 1
嘗試這樣:
su username -c 'echo -e "test 1"'
輸出:
-e test 1
我怎樣才能得到這個工作,所以它輸出字符串沒有-e逃生標誌?
'echo -e'實際上並不是合法*。如同在中,提供這一切的'echo'實現違反了POSIX規範。 –
請參閱http://pubs.opengroup.org/onlinepubs/009604599/utilities/echo.html - 是的,bash違反了規範,但如果同時設置了「posix」和「xpg_echo」標誌它符合,所以你編寫的代碼依賴於'echo -e'是脆弱的。 –
適合我... – arkascha