错误 "sh: : command not found sh: : command not found" 编号 127
error "sh: : command not found sh: : command not found" number 127
我正在尝试使用以下命令制作 AppleScript,但当我 运行 使用 do shell 脚本命令时出现错误。我在终端中尝试了 运行ning 并且它工作得很好所以我认为 AppleScript 告诉 shell 脚本执行有问题。有人有解决办法吗?我的脚本末尾是否还需要一个 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/'"
编辑:另外,您如何将 shell 脚本的输出设为 var?
编辑 2:运行 do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp"
工作正常所以我认为这可能与 tmpdir
有关
编辑 3:我再次 运行 它并且它以某种方式工作得很好所以如果有人知道如何使输出成为一个 var 那将非常感谢!
我复制并粘贴了您的 AppleScript 代码 和 运行 在 Script Editor.它 运行 没有错误,我认为 code.
没有任何问题
要使 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/'"
你不需要 end run
除非你有 on run
。
我正在尝试使用以下命令制作 AppleScript,但当我 运行 使用 do shell 脚本命令时出现错误。我在终端中尝试了 运行ning 并且它工作得很好所以我认为 AppleScript 告诉 shell 脚本执行有问题。有人有解决办法吗?我的脚本末尾是否还需要一个 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/'"
编辑:另外,您如何将 shell 脚本的输出设为 var?
编辑 2:运行 do shell script "screencapture -R123,456,1,1 -t bmp $TMPDIR/test.bmp"
工作正常所以我认为这可能与 tmpdir
编辑 3:我再次 运行 它并且它以某种方式工作得很好所以如果有人知道如何使输出成为一个 var 那将非常感谢!
我复制并粘贴了您的 AppleScript 代码 和 运行 在 Script Editor.它 运行 没有错误,我认为 code.
没有任何问题要使 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/'"
你不需要 end run
除非你有 on run
。