#/bin/bash
corr="apple"
echo $corr
osascript -e 'tell application "Messages" to send "Did you mean "'"$corr"'" " to buddy "A"'
Error:
51:57: syntax error: A identifier can’t go after this “"”. (-2740)
If I just pass
osascript -e 'tell application "Messages" to send "Did you mean $corr " to buddy "A"'
the message comes like "Did you mean $corr"
I have tried everything mentioned at Pass in variable from shell script to applescript
Did you mean "apple", then you aren't escaping the quotation marks aroundapple. The first one closes the message, so thatappleis an unexpected identifier, not part of the message string.