osascript using bash variable with a space

You could try to use instead : osascript -e “display notification \”$var2\”” Or : osascript -e ‘display notification “‘”$var2″‘”‘ This fixes the problem of manipulation of variables that contains spaces in bash. However, this solution doesn’t protect against injections of osascript code. So it would be better to choose one of Charles Duffy’s solutions or … Read more