Mike
Mike

Reputation: 785

Trying to run a shell script using AppleScript

This might be a bit of a dumb question as I'm new to AppleScript, but I'm trying to run a very simple shell script in terminal using AppleScript. The code I'm currently using is:

tell application "Terminal"
    do script "videoLoop"
end tell

but I keep getting the error

-bash: fork: Resource temporarily unavailable

Could I also just type "videoLoop.sh" into terminal using AppleScript?

Any help would be appreciated

Upvotes: 0

Views: 123

Answers (1)

Mic
Mic

Reputation: 38

If you need it to open a terminal window use something like this:

tell application "Terminal"
    do script "/Users/youruser/testdir/hello.sh"
end tell

Else, if you just want it to run the script do something like this:

do shell script "/Users/youruser/testdir/hello.sh"

You need the full path, and your script needs execute permissions.

My examples just echo the standard Hello World text but the same should work for most other scripts provided they're written properly.

Upvotes: 1

Related Questions