For example, I would like to do the following:
mv xxxx xxxx.bak
I know I could use this command instead:
mv xxxx{,.bak}
I think this is not direct somehow. It would be wonderful if I could do this:
mv xxxx $1.bak
And sometimes I'd need it like this:
echo xxxx yyyy $1.suffix
I know we can refer to arguments of the previous command using !:n
, but can I also refer to arguments of the current command?
BTW, I want to do it directly in the shell, interactively.
!$
to refer to the current command and uses$
to refer to the previous (instead of the very first) argument. For example,ocrmypdf --deskew --optimize 3 my.pdf !#$:r_ocr.pdf
will expand the last argument tomy_ocr.pdf
.