$ echo !?foo?$:t:s/bar/baz/
(Just in case you're wondering: This will look for the most recent command line in the history containing the string »foo«, pick up the last word of that line, discard everything from that word except for the last filename component, and return that with the string »bar« replaced by »baz«. And just for the record, I don't use such things myself as my poor brain cannot handle them as a matter of course.)
1 comment:
Actually, history expansion and substitution are features of the shell I use *very* often. Especially !$ is almost a compulsion. Sensible shells - zsh, tcsh - make it much less awkward than the bloody awful shell though. With completion and editing.
Post a Comment