Running Shell Scripts With AppleScript

While I was playing with AppleScript earlier this week I wanted to run a shell script I’d written from within Finder rather than from a shell prompt in Terminal.app.

On Windows I tend to write scripts to run under Cygwin and then write a wrapper batch file to run the script under the control of Cygwin’s bash executable.

Turns out the AppleScript solution is identical in principal and is as simple as

do shell script "/full/path/to/shell/script"

You may need to adjust the path to the script dependent upon whether the directory where your script resides is in your $PATH or not.

Written by Gary

Husband, Father, geotechnologist, map geek, coffee addict, Sci-fi fan, UNIX and Mac user.