Search This Blog

Sunday, 2 January 2011

Mac: Shell scripts to commands

I have some shell scripts that run rsync to backup to the server. Each time I need to run these, it means opening Terminal, entering the command (or scrolling through bash history). So, is there a better way?

Well, yes, there are two better ways. One is to make the script into a command, the other is to run in Apple Script.

These two links set me on the right path - http://macosx.com/forums/howto-faqs/25649-howto-run-command-line-apps-scripts-finder-applescript.html and http://hints.macworld.com/article.php?story=20010827215428108

Apple Script version is this:

do shell script "/Users/<me>/Bin/backup_music_orig_inc_podcasts.sh"

The other variant is to change file extension from .sh to .command and then (this is the important part), in Terminal:

chmod ug+x backup_pictures2.command