Add Bash Scripts To Application

Hello,

Is there a way to compile bash scripts into an applescript project and if so how would you do it? The lead up to this post is this;

I have numerous bash scripts for controlling the bash ftp client. I call them with the do shell script command and also pass arguments to the script with this command as well.

Ex. do shell script bashScriptName & " " & u_name & " " & " " pass_word & " " & ftp_server

This works well but, it would be way better if I could compile then into the app so that they don’t get deleted and or moved becuase as I’m sure you know they have to remain in a set location so that you can setup a /path/to/the/script to call it

Any help would be greatly appreciated as usual.
Thanks :slight_smile:
Dallas

With Xcode, add the file to your project, being sure to check “copy items into destination group’s folder (if needed)”. The shell script should be included in the application’s Resources folder.

Edit: For the sake of completeness: Adding Files, Frameworks, and Folders to a Project

Thanks Bruce, How do I call it though?

Different methods of getting the path to a resouce in a application package…

Most compatible:

set theResource to ((path to me as Unicode text) & "Contents:Resources:filename") as alias
--> alias

Only on Mac OS X 10.4 or later:

set theResource to (path to resource "filename")
--> alias

Only with AppleScript Studio’s bundle class (Technical Q&A QA1493):

set theResource to (resource path of main bundle) & "filename"
--> POSIX path

See also:
Call a CLI executable in the Resources directory?
Passing path within “do shell script”
Calling to Files within a Bundle or App…

Thanks Bruce, That worked exactly how I had hoped. You are the man.
Dallas