[英]error “sh: : command not found sh: : command not found” number 127
I am trying to make an AppleScript with the commands below and when I run it has an error with the do shell script command.我正在尝试使用以下命令制作 AppleScript,当我运行它时,do shell 脚本命令出错。 I tried running this in terminal and it works perfectly fine so I think there's a problem with the AppleScript telling the shell script to execute.我尝试在终端中运行它,它工作得非常好,所以我认为 AppleScript 告诉 shell 脚本执行存在问题。 Does anybody have a solution?有人有解决方案吗? Also is it necessary to have an end run
at the end of my script?还有必要在我的脚本结束end run
吗?
do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp &&
xxd -p -l 3 -s 54 $TMPDIR/test.bmp |
sed 's/\\(..\\)\\(..\\)\\(..\\)/\\3\\2\\1/'"
Edit: Also how would you make the output of the shell script a var?编辑:另外,您如何将 shell 脚本的 output 设为 var?
Edit 2: Running do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp"
works just fine so I think it may have to do with the tmpdir编辑 2:运行do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp"
工作得很好,所以我认为它可能与 tmpdir
Edit 3: I ran it again and it worked just fine somehow so if anyone knows how to make the output a var that would be great thanks!编辑 3:我再次运行它,它以某种方式工作得很好,所以如果有人知道如何使 output 成为一个 var,那将非常感谢!
I copied and pasted your AppleScript code and ran it in Script Editor .我复制并粘贴了您的AppleScript代码并在Script Editor中运行它。 It ran without error and I see nothing wrong with the code .它运行没有错误,我看不出代码有什么问题。
To make what is returned from the do shell script
command into a variable use, eg:要将do shell script
命令返回的内容转换为变量使用,例如:
set hexColor to do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp &&
xxd -p -l 3 -s 54 $TMPDIR/test.bmp |
sed 's/\\(..\\)\\(..\\)\\(..\\)/\\3\\2\\1/'"
You do not need an end run
unless you have an on run
.除非您有on run
,否则您不需要end run
run 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.