【发布时间】:2017-12-02 16:31:26
【问题描述】:
我找到了用于 CPU Throttling 的 sh-script,并希望通过以下方式使用 AppleScript 在启动时安排它:
do shell script "sudo /Users/BohdanAir/Documents/Automation/cputhrottler.sh" "password mypassword" with administrator privileges
并得到以下错误:
error "sudo: /Users/BohdanAir/Documents/Automation/cputhrottler.sh: command not found" number 1
P.S: 提供给sh 文件的通行证是从Get Info 选项(CDM + I)完全复制的
【问题讨论】:
-
不要将
sudo与with administrator privileges一起使用 请参阅TechNote 2065。删除sudo -
虽然 varian 提出了很好的观点,但它出错的主要原因是您试图执行一个未设置为可执行的脚本,或者作为执行 shell 的直接参数执行.详情见我的回答。
标签: terminal applescript sh