Files
cheatsheet-tldr/tldr/^
2024-09-11 00:16:06 +00:00

23 lines
604 B
Plaintext

---
syntax: markdown
tags: [tldr, common]
source: https://github.com/tldr-pages/tldr.git
---
# 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}}`