- Bash Quick Start Guide
- Tom Ryder
- 132字
- 2021-07-23 16:58:59
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.
推薦閱讀
- 大數據導論:思維、技術與應用
- 手把手教你學AutoCAD 2010
- 返璞歸真:UNIX技術內幕
- Cloudera Administration Handbook
- 統計挖掘與機器學習:大數據預測建模和分析技術(原書第3版)
- INSTANT Puppet 3 Starter
- Mastering Text Mining with R
- Dreamweaver+Photoshop+Flash+Fireworks網站建設與網頁設計完全實用
- 一步步寫嵌入式操作系統
- 基于Proteus的單片機應用技術
- 手把手教你學Photoshop CS3
- Learning Cassandra for Administrators
- DynamoDB Applied Design Patterns
- 網絡安全概論
- 玩轉PowerPoint