I have a shell script that i want to be able to just double click on to run. The script will back up user data before netrestore runs. I tried to do run shell script in apple script, but there are to many spaces and commands it dose not like. Any ideas???
You should be able to save the shell script in your user directory, add that path to your shell profile, and then make a short applescript that calls your shell script:
do shell script "yourShellScript.sh"
Once you have that working, save the AS script as an application, and double click it anytime.
Another way to do this might be to make a shell script runner. I’m not thinking right now, but it’s something like this. You use the Finder to direct your file to open with a shell script runner. You set the open with by get info in the finder and browse to choose a stay open script (AppleScript app). The AppleScript app might look something like this:
on open p
set t to read p
do shell script t
set r to result
display dialog r
end open
When you double click on your unix script which is set to open with this app, the Finder sends a reference of your unix text file to this app. The variable p (editted: changed t to p) is the reference and your script app reads the text file. It then do shell script the text. I don’t know why it’s not working now. The script app should display the result of the unix scipt. This is an offshoot of running compiled script from the dock.
If you’d like to see Terminal when you’re script is run, you could rename your file so that is ends with “.command” (instead of .sh, or whatever you’re using).
Why not change this.
set r to result
display dialog r
.to this:
display dialog result
Also, would you please use AppleScript tags when posting code (see this page).
The reason why I don’t use the AppleScript post is because it doesn’t work in Jaguar when opening it back up in the Script Editor. If I copy back from the tagged script and paste it into The Script Editor, that doesn’t come out right especially on with long scripts. I tried it before, but will do it if it is important.