1、查看內核
root@PC1:~/GS/lihua/test# hostnamectl Static hostname: PC1 Icon name: computer-vm Chassis: vm Machine ID: dc50d4dc469c45ea8a2a10f39caa45e9 Boot ID: 28566ddce150405d8573cdbbd676465d Virtualization: vmware Operating System: Ubuntu 20.04.3 LTS Kernel: Linux 5.11.0-38-generic Architecture: x86-64
2、問題, 在紅帽、centos中不會出現這樣的問題
root@PC1:~/GS/lihua/test# ls a.mp4 dup1.mp4 dup2.mp4 dup4.mp4 root@PC1:~/GS/lihua/test# rename mp4 txt * Bareword "mp4" not allowed while "strict subs" in use at (user-supplied code).
3、經查詢找到的解決方法,類似sed的替換命令
root@PC1:~/GS/lihua/test# ls a.mp4 dup1.mp4 dup2.mp4 dup4.mp4 root@PC1:~/GS/lihua/test# rename 's/mp4/txt/' * root@PC1:~/GS/lihua/test# ls a.txt dup1.txt dup2.txt dup4.txt
參考:http://cssor.com/linux-rename-files.html