mv 引发错误消息,但文件已移动

mv 引发错误消息,但文件已移动

我承认我不是 unix 命令方面的专家,但我将文件移动到另一个目录并收到错误消息 - 但文件已移动。为什么会mv: rename to to /Users/billtubbs/Library/Script Libraries/to: No such file or directory出现此消息“ ”?是因为 Library 是受保护的文件夹而我应该使用吗sudo ...

这是在 Mac OS X 10.13.4 上的终端中:

BillsMacBookPro:Scripts billtubbs$ ls ~/Library/'Script Libraries'
BillsMacBookPro:Scripts billtubbs$ mv FileHandlers.scpt to ~/Library/'Script Libraries'
mv: rename to to /Users/billtubbs/Library/Script Libraries/to: No such file or directory
BillsMacBookPro:Scripts billtubbs$ ls
Address Book Scripts                    Terminal scripts
Applications                            Test Script read html page .scpt
Bus Data                                Test script parse html form.scpt
Firefox scripts                         TextDataFromFile.scpt
ListHandlers.scpt                       TextHandlers.scpt
Mail Scripts                            What Time Is It? Old.scpt
Morning routine OLD.scpt                What Time Is It?.app
Morning routine.app                     What time is it?.scpt
Morning routine.scpt                    What time is it?.scptd
NumberHandlers.scpt                     When's the next bus?.scpt
Numbers scripts                         When's the next number 19 bus?.scpt
POF member details.scpt                 When's the next number 20 bus?.scpt
README.md                               When's the next number 25 bus?.scpt
Safari scripts                          mail subject line.scpt
Save mail message to file.scpt          mail_read.scpt
Speak_time.applescript                  save mail_copy.scpt
Speak_time.scpt                         search POF script.scpt
Speak_time.zip
BillsMacBookPro:Scripts billtubbs$ mv TextHandlers.scpt to ~/Library/'Script Libraries'
mv: rename to to /Users/billtubbs/Library/Script Libraries/to: No such file or directory
BillsMacBookPro:Scripts billtubbs$ ls ~/Library/'Script Libraries'
FileHandlers.scpt       TextHandlers.scpt
BillsMacBookPro:Scripts billtubbs$ ls TextH*
ls: TextH*: No such file or directory

答案1

因为你说

MV  (源文件名)    (目标目录)

而且 Unix 命令不是英语——你不会说类似的mv东西to某处。  mv

MV  (源文件名1 ) (源文件名2 )  (目标目录)

在哪里(source filename2)曾是to,错误消息表明没有这样的文件to

答案2

看来您误解了该mv命令的工作原理。to参数中没有,因此它被解释为文件名,但不存在这样的文件。

man 1 mv

SYNOPSIS
   mv [OPTION]... [-T] SOURCE DEST
   mv [OPTION]... SOURCE... DIRECTORY
   mv [OPTION]... -t DIRECTORY SOURCE...

相关内容