Skip to content

OSX alternate-browser script #223

Answered by PeterWone
ghost asked this question in Q&A
Discussion options

You must be logged in to vote
open -a "Google Chrome" $@

Let's break this down.

  • On OSX, open -a "application name" runs an application by name, which is path independent. In this case the application is "Google Chrome". The double-quotes are required when there is a space in the name.
  • $@ means pass the entire command line apart from the application name. It differs from $* in that $* parses the parameters first and passes them individually, which can mess with whitespace and order. $@ passes the whole thing through as one big string.

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by PeterWone
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #209 on May 18, 2023 23:09.