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

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.

主站蜘蛛池模板: 合肥市| 六枝特区| 册亨县| 图们市| 大渡口区| 信宜市| 安庆市| 康保县| 云龙县| 济阳县| 报价| 遂宁市| 将乐县| 大埔县| 寻乌县| 凯里市| 泰来县| 贡嘎县| 凤阳县| 稻城县| 平凉市| 大新县| 永济市| 闽清县| 屯留县| 沧州市| 西峡县| 剑河县| 吉隆县| 收藏| 龙海市| 莱阳市| 达州市| 隆安县| 犍为县| 新津县| 桐梓县| 温宿县| 泸定县| 达日县| 伽师县|