osascript variable syntax

I’m sorry if this seems a silly question, but my search yielded no answers:

what is the proper syntax for utilizing variables in osascript?

Example:

#!/bin/sh

server=zafod
share=beeblebrox

osascript -e ‘mount volume “smb://$server/$share”’

exit 0

So the thing to remember here is that your osascript line should be quoted and so should the parameter to the mount volume command. So just outer quote the command and then escape quote the inner quotes and you end up with something like this.

#!/bin/sh

server=zafod
share=beeblebrox

osascript -e "mount volume \"smb://$server/$share\""

I just tested it with an AFP volume and it worked.

With regards to mounting volumes, see also the mount(8) manpage along with other goodies such as mount_smbfs(8).