Open an .html file with default browser using Bash on Mac

前端 未结 8 1647
陌清茗
陌清茗 2020-12-13 17:17

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

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-13 17:31

    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"

提交回复
热议问题