使用Ubuntu 18.04。假设我们有一个名为debug.log
的文件。您可以使用以下任一命令创建名为debug_BACKUP.log
的副本:
cp debug.log debug_BACKUP.log
cp debug{,_BACKUP}.log
或者,将cp
替换为mv
重命名文件。
现在假设我们有debug1.log
和debug2.log
。我们想创建名为debug1_BACKUP.log
和debug2_BACKUP.log
的副本。是否有单个命令可以实现这一目标?
当我尝试以下任一方法时:
cp debug*.log debug*_BACKUP.log
cp debug*{,_BACKUP}.log
错误是cp: target 'debug*_BACKUP.log' is not a directory
。