相同点:echo与printf 都是bash的内置命令
不同点:echo返回0状态,并且在标准输出输出。
printf可以返回不同状态,并且可以格式化输出。
Both echo and printf are Bash built-in commands. The first always exits with a 0 status, and simply prints
arguments followed by an end of line character on the standard output, while the latter allows for definition of
a formatting string and gives a non-zero exit status code upon failure.

本文比较了bash内置命令echo与printf的区别。echo总返回0状态并在标准输出打印内容,而printf支持格式化输出并可根据失败情况返回非零状态码。
1889

被折叠的 条评论
为什么被折叠?



