Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion content/ch3.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ bash$ echo $PATH
/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/sbin:/usr/sbin:/usr/games
```
A colon is acceptable as a function name.
>`冒號可當作函數名稱。`
```
:()
{
Expand All @@ -341,9 +342,10 @@ A colon is acceptable as a function name.
# The name of this function is :
```
This is not portable behavior, and therefore not a recommended practice. In fact, more recent releases of Bash do not permit this usage. An underscore _ works, though.

>`這是不可移植的作法,因此不推薦這樣的行為。事實上,最近所釋出的Bash版本並不允許這種用法。但使用下劃線「_」即可運作。`

A colon can serve as a placeholder in an otherwise empty function.
>`在空函數之中,冒號可做為暫駐功能。`
```
not_empty ()
{
Expand All @@ -352,10 +354,13 @@ not_empty ()
```
!
reverse (or negate) the sense of a test or exit status [bang]. The ! operator inverts the exit status of the command to which it is applied (see Example 6-2). It also inverts the meaning of a test operator. This can, for example, change the sense of equal ( = ) to not-equal ( != ). The ! operator is a Bash keyword.
>`反轉(或否定)測試或退出當前程式狀態的用途[bang]。驚嘆號用作反轉命令,以及其所施加的退出狀態(請參照範例6-2),同時驚嘆號也可反轉操作者的意圖,例如將等於(=)轉為不等於(!=)。驚嘆號是Bash中的關鍵單字。`

In a different context, the ! also appears in indirect variable references.
>`在不同的內文之中,驚嘆號也出現在間接變數的引用之中。`

In yet another context, from the command line, the ! invokes the Bash history mechanism (see Appendix L). Note that within a script, the history mechanism is disabled.
>`另一方面,在命令列中,驚嘆號調用Bash的歷史紀錄(請見 Appendix L)。請注意在腳本中,歷史紀錄是無法作用的。`

*
wild card [asterisk]. The * character serves as a "wild card" for filename expansion in globbing. By itself, it matches every filename in a given directory.
Expand Down