How to rename with prefix/suffix?

前端 未结 9 1526
独厮守ぢ
独厮守ぢ 2020-11-27 10:52

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

9条回答
  •  一个人的身影
    2020-11-27 11:17

    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
    

提交回复
热议问题