Embed shell script in applescript

Hi, is there a way to embed external shell scripts into an applescript application? I have several long shell scripts that I’m using in my applescript and I’d like to make it easy to move my application around (eg make it one file).

Am I limited to putting the shell script text inside the script itself? And if so, what characters do i have to escape besides ""?

Thanks

  1. Put the shell scripts inside the app’s bundle contents.
  2. Make code to get the POSIX path of the code.
  3. Add "do shell script "sh " & shpath

NOTE: shpath is a variable.

Hope that helps. :smiley:

You can also embed the code in an AppleScript string and use do shell script "sh -c " & quoted form of shellScriptText & " - " & quoted form of arg1 & " " & quoted form of arg2 – etc.. Most other ˜script interpreters’ have similar options (perl and ruby take -e).

Thanks guys! I think I know what you mean. The app bundle idea sounds like what I was looking for. The embed in a sting idea is also something that will definitely come in handy as well.

Thanks again