在 MacOS 的终端中为多个 .pdf 文件的名称添加一个字符串

add a string to the name of several .pdf file in Terminal in MacOS

在 MacOS 中使用终端,将特定字符串添加到多个 .pdf 文件的名称的命令是什么。例如:如果我有

firstfile.pdf
anotherfile.pdf
documentthree.pdf

我要全部重命名

addedstring_firstfile.pdf
addedstring_anotherfile.pdf
addedstring_documentthree.pdf

能否请您尝试以下操作(没有 mac os 所以没有测试)。

for file in *.pdf
do
   mv "$file" "string_$file"
done