summaryrefslogtreecommitdiff
path: root/Base/usr
diff options
context:
space:
mode:
authorTheFightingCatfish <seekingblues@gmail.com>2021-07-30 18:55:57 +0800
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-08-02 02:58:55 +0430
commitf67c2c97b112020bfde7c74d535a912a8951c5e0 (patch)
tree3a3bc3de8bbc3661391cce544e47f1a1ee246756 /Base/usr
parent05c3755e62f5d83dd1a7f5bd8f4b5496fdc6aa1f (diff)
downloadserenity-f67c2c97b112020bfde7c74d535a912a8951c5e0.zip
Shell: Improve the parsing of history event designators
Diffstat (limited to 'Base/usr')
-rw-r--r--Base/usr/share/man/man5/Shell.md27
1 files changed, 16 insertions, 11 deletions
diff --git a/Base/usr/share/man/man5/Shell.md b/Base/usr/share/man/man5/Shell.md
index b70cd87096..29d2d041c4 100644
--- a/Base/usr/share/man/man5/Shell.md
+++ b/Base/usr/share/man/man5/Shell.md
@@ -362,20 +362,25 @@ match "$(make_some_value)" {
History expansion may be utilized to reuse previously typed words or commands.
Such expressions are of the general form `!<event_designator>(:<word_designator>)`, where `event_designator` would select an entry in the shell history, and `word_designator` would select a word (or a range of words) from that entry.
-| Event designator | effect |
+| Event designator | Effect |
| :- | :----- |
-| `!` | Select the immediately preceding command |
-| _n_ | Select the _n_'th entry in the history |
-| -_n_ | Select the last _n_'th entry in the history |
-| _str_ | Select the most recent entry starting with _str_ |
-| ?_str_ | Select the most recent entry containing _str_ |
+| `!` | The immediately preceding command |
+| _n_ | The _n_'th entry in the history, starting with 1 as the first entry |
+| -_n_ | The last _n_'th entry in the history, starting with -1 as the previous entry |
+| _str_ | The most recent entry starting with _str_ |
+| `?`_str_ | The most recent entry containing _str_ |
-| Word designator | effect |
+| Word designator | Effect |
| :-- | :----- |
-| _n_ | The _n_'th word, starting with 0 as the command |
-| `^` | The first word (index 0) |
-| `$` | The last word |
-| _x_-_y_ | The range of words starting at _x_ and ending at _y_ (inclusive) |
+| _n_ | The word at index _n_, starting with 0 as the first word (usually the command) |
+| `^` | The first argument (index 1) |
+| `$` | The last argument |
+| _x_-_y_ | The range of words starting at _x_ and ending at _y_ (inclusive). _x_ defaults to 0 if omitted |
+| `*` | All the arguments. Equivalent to `^`-`$` |
+| _x_`*` | The range of words starting at _x_ and ending at the last word (`$`) (inclusive) |
+| _x_- | The range of words starting at _x_ and ending at the second to last word (inclusive). _x_ defaults to 0 if omitted |
+
+Note: The event designator and the word designator should usually be separated by a colon (`:`). This colon can be omitted only if the word designator starts with `^`, `$` or `*` (such as `!1^` for the first argument of the first entry in the history).
## Formal Grammar