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

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.

主站蜘蛛池模板: 汝阳县| 天台县| 广东省| 武清区| 衡东县| 临汾市| 平潭县| 通道| 桦甸市| 湘潭市| 黄龙县| 商都县| 延津县| 西畴县| 龙陵县| 温泉县| 安泽县| 文成县| 奉新县| 治县。| 江陵县| 星座| 平山县| 凤山市| 张家川| 宜川县| 金阳县| 寿光市| 铜山县| 开鲁县| 林周县| 惠安县| 沁源县| 西和县| 阳江市| 勃利县| 上饶市| 丰宁| 佛山市| 高阳县| 安乡县|