2

我在 AppleScript 文件中有以下代码,它应该挂载一个托管在我的网络上的 sparsebundle。运行此脚本会在hdiutil命令上引发错误:

try
  mount volume "smb://192.168.1.1/sda2"
end try

do shell script "hdiutil attach -mountpoint /Volumes/sda2 timemachine.sparsebundle"

我收到的错误是:

hdiutil: attach failed - No such file or directory" number 1

在终端中运行 shell 脚本代码工作得很好,并且脚本构建得很好。有任何想法吗?

4

1 回答 1

4

得到它的工作。我更改了hdiutil命令语法,现在 AppleScript 不会抛出错误。

try
  mount volume "smb://192.168.1.1/sda2"
end try

do shell script "hdiutil attach /Volumes/sda2/timemachine.sparsebundle/"

不知道为什么原始命令在终端中仍然有效,但在 AppleScript 中失败,但至少现在有效。

于 2013-11-20T04:59:47.433 回答