3 ms·
I think ^help^ does the same thing. The bash manual says ^string1^string2^ is equivalent to !!:s/string1/string2/ where / can be any delimiter, and the
by yesenadam 5y ago
I think
^help^
does the same thing. The bash manual says ^string1^string2^ is equivalent to
!!:s/string1/string2/
where / can be any delimiter, and the "final delimiter is optional if it is the last character of the event line." So, not so surprising that the third ^ is optional too.
TIL: In either of these forms, if string1 is empty, it is set to the last string1, or, "if no previous history substitutions took place, the last string in a !?string[?] search." E.g.
$ echo foofoo
foofoo
$ ^foo^
echo foo
foo
$ ^^bar
echo bar
bar
- unfocussed_mike 5y ago> is equivalent to > !!:s/string1/string2/ I didn't know about this syntax either. I thought I knew a bit of bash and it turns out I'm a novice after all this time. How fun.