How to rename with prefix/suffix?
bash, filenames, mv, prefix, rename
Solution
In Bash and zsh you can do this with Brace Expansion. This simply expands a list of items in braces. For example:
# echo {vanilla,chocolate,strawberry}-ice-cream
vanilla-ice-cream chocolate-ice-cream strawberry-ice-cream
So you can do your rename as follows:
mv {,new.}original.filename
as this expands to:
mv original.filename new.original.filename
Problem
How do I do `mv original.filename new.original.filename` without retyping the original filename? I would imagine being able to do something like `mv -p=new. original.filename` or perhaps `mv original.filename new.~` or whatever - but I can't see anything like this after looking at `man mv` / `info mv` pages. Of course, I could write a shell script to do this, but isn't there an existing command/flag for it?