问题描述
我该怎么办 MV original.filename new.original.filename
无需重新键入原来的文件名?
How do I do mv original.filename new.original.filename
without retyping the original filename?
我会想象能够做类似 MV -p =新。 original.filename
或者 MV original.filename新的〜
或什么 - 但我看不出这样的事情在看<$ C后$ C> MV的人 / 信息MV
页。
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.
当然,我可以写一个shell脚本来做到这一点,但是是不是有一个现有的命令/标志呢?
Of course, I could write a shell script to do this, but isn't there an existing command/flag for it?
推荐答案
在Bash和zsh中你可以用的。这只是扩大了在括号项目清单。例如:
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
这篇关于如何使用preFIX /后缀命名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!