Bareword "mp4" not allowed while "strict subs" in use at (usersupplied code). ubuntu

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

原文地址:https://www.cnblogs.com/liujiaxin2018/p/15449252.html