Parameter extension using dollar bang (`! $`)
Is it possible to use !$ In the context of parameter expansion? The desired use that motivates this question is a quick (from the point of view of key touches) change of the file name (for example, instead of saving the file name in a variable and executing rsvg-convert $svg > ${svg/.svg/.png} instead use rsvg-convert $! > $!{/.svg/.png} , where $!{/.svg/.png} is the wrong syntax indicating the desired effect when this file was the last marker on the previous line, such A command can often be entered faster than alternatives, such as using tab completion in the presence of files with a pref X of various lengths, or copying and pasting a file name by selection with the mouse). As far as I can tell, in such a context there is no way to use !$ , But perhaps, through some nit-picking, you can achieve a similar effect.
Depending on how complex you want the substitution, the story extension supports replacing the first occurrence of a string with another. You simply precede the substitution : as follows:
rsvg-convert !$ > !$:s/.svg/.png You can see all the story modifiers here.
At least in bash emacs mode, the last argument of the previous command line will also be placed (not for expansion when the command starts) if you press alt + . . Therefore, in this case, it may be the fastest type:
rsvg-convert then alt + . > alt + . , then delete the extension it added with alt + bksp , then the new extension: png