So, this is what I need :
Let's say I have an index.html
file.
How do I tell the terminal to open it using the default browser?
(Using AppleScript, BASH,...?)
I think what you want is simply this. And simply type: browse (your file name) without the parentheses of course. This will run your HTML file in Firefox browser.
Once you have ssh'ed into the server, install a web server in that box. Say the file is named index. html, you should make it available at the URL http://localhost:8000/index.html or port number can be anything. This works provided python is installed on the server.
from the directory containing index.html, try...
open ./index.html
the open command opens a file (or directory, or URL). open is included with MacOSx. specifics and options can be found using
man open
note: default application is determined via LaunchServices.
You can use the open command with the -a flag to open a file or location in Chrome (or any target application):
open -a "Google Chrome" index.html
This also works with URLs, i.e. open -a "Google Chrome" http://www.apple.com.
---> I found this answer @ stack exchange, thanks to user "robmathers"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With