1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-24 01:22:10 +02:00
tldr/pages/common/^.md
Managor 10a3a4ed40
^: add example (#14036)
Co-authored-by: Lena <126529524+acuteenvy@users.noreply.github.com>
2024-10-07 14:47:58 +02:00

21 lines
583 B
Markdown

# Caret
> Bash builtin to quick substitute a string in the previous command and run the result.
> Equivalent to `!!:s^string1^string2`.
> More information: <https://gnu.org/software/bash/manual/bash.html#Event-Designators>.
- 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}}`
- Replace all occurrences of `string1`:
`^{{string1}}^{{string2}}^:&`