Shell variables don't expand inside single quotes. When you to want pass a shell variable to osascript
you need to use double ""
quotes. The problem is, than you must escape double quotes needed inside the osascript, like:
the script
say "Hello" using "Alex"
you need escape quotes
text="Hello"
osascript -e "say \"$text\" using \"Alex\""
This not very readable, therefore it much better to use the bash's heredoc
feature, like
text="Hello world"
osascript <<EOF
say "$text" using "Alex"
EOF
And you can write multiline script inside for a free, it is much better than using multiple -e
args...