Thursday, May 14, 2009

Open Webpage/File In Local Dir via Firefox, Safari via Bash Script/Command-Line

If you want to open a file or webpage in the current directory using Firefox, Safari, or another browser in OS X, here is an example bash script you can use. You could also use it at command-line:
# Example to open up a page in Firefox from command-line
open -a /Applications/ file://$PWD/index.html
Change index.html to whatever the filename is, and chmod +x the bash filename. If you're having trouble executing it, look in /Applications to find the correct name.

No comments: