- 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.
推薦閱讀
- 計算機應用
- Learning Microsoft Azure Storage
- 數控銑削(加工中心)編程與加工
- Hands-On Cybersecurity with Blockchain
- Windows游戲程序設計基礎
- 人工智能實踐錄
- 變頻器、軟啟動器及PLC實用技術260問
- 水下無線傳感器網絡的通信與決策技術
- Grome Terrain Modeling with Ogre3D,UDK,and Unity3D
- 一步步寫嵌入式操作系統
- Puppet 3 Beginner’s Guide
- PowerPoint 2010幻燈片制作高手速成
- 新一代人工智能與語音識別
- FreeCAD [How-to]
- 計算機應用基礎學習指導與練習(Windows XP+Office 2003)