简体   繁体   中英

How can I open up chrome programatically from the bash shell?

I've learned how to kill it by simply using

pkill Chrome

but how do I open it in bash in OS X ?

This should do it:

$ open -a "Google Chrome"

or

$ open -a Google\ Chrome

More information:

$ manx open

You can use /usr/bin/open -a command to run your browser. adding --args will open the browser from the command line and go to the target URL

/usr/bin/open -a "/Applications/Google Chrome.app" --args 'http://google.com/'

You should not need the full path of open as bash already knows where to find this.

It also knows where to find Chrome.

However you do need the full path of Chrome:

open -a "Google Chrome" --args 'gmail.com' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM