Update bash.md
This commit is contained in:
parent
ef9f00aa5c
commit
d5683a9ddf
24
bash.md
24
bash.md
|
@ -564,21 +564,25 @@ History
|
|||
|
||||
### Operations
|
||||
|
||||
| `!!` | Execute last command again |
|
||||
| `!!:s/<FROM>/<TO>/` | Replace first occurrence of `<FROM>` to `<TO>` in most recent command |
|
||||
| `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command |
|
||||
| `!$:t` | Expand only basename from last parameter of most recent command |
|
||||
| `!$:h` | Expand only directory from last parameter of most recent command |
|
||||
| Code | Description |
|
||||
| -------------------- | --------------------------------------------------------------------- |
|
||||
| `!!` | Execute last command again |
|
||||
| `!!:s/<FROM>/<TO>/` | Replace first occurrence of `<FROM>` to `<TO>` in most recent command |
|
||||
| `!!:gs/<FROM>/<TO>/` | Replace all occurrences of `<FROM>` to `<TO>` in most recent command |
|
||||
| `!$:t` | Expand only basename from last parameter of most recent command |
|
||||
| `!$:h` | Expand only directory from last parameter of most recent command |
|
||||
|
||||
`!!` and `!$` can be replaced with any valid expansion.
|
||||
|
||||
### Slices
|
||||
|
||||
| `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) |
|
||||
| `!^` | Expand first argument from most recent command |
|
||||
| `!$` | Expand last token from most recent command |
|
||||
| `!!:n-m` | Expand range of tokens from most recent command |
|
||||
| `!!:n-$` | Expand `n`th token to last from most recent command |
|
||||
| Code | Description |
|
||||
| -------- | ---------------------------------------------------------------------------------------- |
|
||||
| `!!:n` | Expand only `n`th token from most recent command (command is `0`; first argument is `1`) |
|
||||
| `!^` | Expand first argument from most recent command |
|
||||
| `!$` | Expand last token from most recent command |
|
||||
| `!!:n-m` | Expand range of tokens from most recent command |
|
||||
| `!!:n-$` | Expand `n`th token to last from most recent command |
|
||||
|
||||
`!!` can be replaced with any valid expansion i.e. `!cat`, `!-2`, `!42`, etc.
|
||||
|
||||
|
|
Loading…
Reference in New Issue