我只是想在用户点击“取消”按钮之后停止/退出脚本。
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if'
尽管它将继续执行剩余的Shell脚本。我也尝试过do shell script "exit"
,return
并以各种方式重新定义了“取消”按钮。
任何建议将不胜感激
这应该是必需的:
osascript -e 'display dialog "" buttons {"Cancel","Continue"} default button 1 Cancel button 1 with icon stop
set xxxx to button returned of the result
if xxxx is "Cancel" then
error number -128
end if' || exit
就是这样!我感到as愧,因为我不知道我可以
&& ||
和osascript
!非常感谢!