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
36 changes: 36 additions & 0 deletions pages.zh_TW/common/!.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# !

> 在 `sh`、Bash、Zsh、`rbash` 和 `ksh` 中重複使用和擴展 shell 歷史記錄。
> 更多資訊:<https://gnu.org/software/bash/manual/bash.html#Event-Designators>.

- 使用前一條命令並以 `sudo` 執行:

`sudo !!`

- 使用透過 `history` 找到的基於行號的命令進行替換:

`!{{number}}`

- 使用在指定行數之前使用的命令進行替換:

`!-{{number}}`

- 使用以特定字串開頭的最新命令進行替換:

`!{{string}}`

- 使用最新命令的參數進行替換:

`{{command}} !*`

- 使用最新命令的最後一個參數進行替換:

`{{command}} !$`

- 使用最後一條命令但不包含最後一個參數:

`!:-`

- 列印以特定字串開頭的最新命令但不執行:

`!{{string}}:p`