2024-02-24 14:37:56 +00:00
|
|
|
# Caret
|
|
|
|
|
|
|
|
> Bash builtin to quick substitute a string in the previous command and run the result.
|
|
|
|
> Equivalent to `!!:s^string1^string2`.
|
2024-09-10 19:36:38 +01:00
|
|
|
> More information: <https://gnu.org/software/bash/manual/bash.html#Event-Designators>.
|
2024-02-24 14:37:56 +00:00
|
|
|
|
|
|
|
- Run the previous command replacing `string1` with `string2`:
|
|
|
|
|
|
|
|
`^{{string1}}^{{string2}}`
|
|
|
|
|
|
|
|
- Remove `string1` from the previous command:
|
|
|
|
|
|
|
|
`^{{string1}}^`
|
|
|
|
|
|
|
|
- Replace `string1` with `string2` in the previous command and add `string3` to its end:
|
|
|
|
|
|
|
|
`^{{string1}}^{{string2}}^{{string3}}`
|