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

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.

主站蜘蛛池模板: 扶沟县| 彭州市| 沧州市| 大安市| 历史| 九龙县| 普兰店市| 泾阳县| 福州市| 佛坪县| 盱眙县| 宝兴县| 庆阳市| 五大连池市| 克拉玛依市| 遂川县| 九龙坡区| 辛集市| 绥芬河市| 汉川市| 高雄县| 阳原县| 临海市| 曲沃县| 保德县| 桑植县| 博兴县| 湖北省| 邵阳市| 日土县| 沙坪坝区| 广安市| 团风县| 南宫市| 正宁县| 苍山县| 镇赉县| 合作市| 黑龙江省| 金塔县| 邹城市|