Mac OS X (10.6.8)
From terminal, we can execute a bash script easily.
1 | $ /Users/jason/Sites/scripts/myscript.sh |
That works fine, obviously, but it would be soooo cool if we could just call myscript from any location or folder. From terminal, we do the following.
Switch to the current user’s root.
1 | $ cd ~/ |
Add the script path to your bash_profile.
1 2 | $ sudo vi .bash_profile export PATH=/Users/jason/Sites/scripts/myscript.sh:$PATH |
Save, exit and reload your bash_profile.
1 | $ . ~/.bash_profile |
Now we can run myscript from anywhere, with tab completion!
1 | $ myscript |