官术网_书友最值得收藏!

The echo command

The echo builtin command just repeats the arguments you provide it onto the standard output:

$ echo Hello
Hello

This makes it a simple way to emit content to the terminal, including variables:

$ echo 'Hello, '"$USER"\!
Hello, bashuser!

The echo command in Bash has switches that allow you to control the output, such as excluding the final newline, or expanding sequences such as \t to tab characters. However, we caution against using echo in scripts, because for historical reasons it has broken design and portability problems that makes it confusing or error-prone to use, especially when trying to use it with switches. We suggest you always use printf in scripts instead, as its behavior is more predictable, especially when printing variables or control characters such as newlines.

主站蜘蛛池模板: 江达县| 宁明县| 聂拉木县| 阜城县| 珲春市| 贵溪市| 金门县| 尤溪县| 宝应县| 怀仁县| 长治市| 秦安县| 彭阳县| 黄平县| 高碑店市| 赤峰市| 镇赉县| 金沙县| 高密市| 大同县| 信丰县| 金秀| 黄石市| 乌鲁木齐县| 蓝田县| 高邮市| 麦盖提县| 沛县| 宁南县| 临沂市| 贞丰县| 丰都县| 怀安县| 顺昌县| 衡阳市| 边坝县| 洪湖市| 中山市| 花垣县| 定安县| 雅安市|