commit 5da17148b582d3de13b4324cb511e64776b2dcf8
parent 06777bbb1efb4701dae54e8237f04beadb3de4f6
Author: pyratebeard <root@pyratebeard.net>
Date: Fri, 23 Dec 2022 20:24:23 +0000
a_mark_of_ecphoneme
Diffstat:
1 file changed, 8 insertions(+), 9 deletions(-)
diff --git a/entry/a_mark_of_ecphoneme.md b/entry/a_mark_of_ecphoneme.md
@@ -4,11 +4,13 @@ mkdir /a/super/long/file/path/to/my/new/directory/
cd !$
```
-In shells the exclamation mark (!) can be used as an event designator to reference the command history. A lot of users have probably come across this for running the last command again, maybe if they forgot to use `sudo`
+_Note: does not work with all shells. I know bash and zsh work._
+
+In some shells the exclamation mark (!) can be used as an event designator to reference the command history. A lot of users have probably come across this for running the last command again, maybe if they forgot to use `sudo`
```
- ──── ─ pacman -Syu
+$ pacman -Syu
error: you cannot perform this operation unless you are root.
- ──── ─ sudo !!
+$ sudo !!
```
It can also be used with a number to run that command from the history, for example to run the very first command in your history incant
@@ -16,11 +18,8 @@ It can also be used with a number to run that command from the history, for exam
!1
```
-Something I use quite a lot is the ability to reference a field from the last command, mostly the last field `$`. As shown above you can use it to navigate to a directory you have just created, or repeat a username
-```
-
-```
-
+Something I use quite a lot is the ability to reference a field from the last command, mostly the last field (`$`). As shown above you can use it to navigate to a directory you have just created, or anything requiring the last field of the previous command.
+You can also reference the first argument using `!^` or the command word using `!:0`. Note the colon before the zero.
-These event designators are quite extensive so check the manpages for more information.
+These event and word designators are quite extensive so check the manpages for more information.