osascript -e "set x to 3"
osascript -e "if x is 5 then"
osascript -e " tell application \"System Events\" to keystroke return"
osascript -e "end if"
私が得る出力
14:14: syntax error: Expected end of line but found end of script. (-2741)
0:6: syntax error: A “if” can’t go after this “end”. (-2740)
スクリプトの何が問題なのかわかりません。インデントに問題がある可能性があります。bash ファイル内で osascript を使用した人はいますか?