2

I'm trying to write a small script that launches Beyond Compare when I do an svn diff. I got it working up until so far:

open -a /Applications/Beyond\ Compare.app "$6" "$7"

To get the full functionality, I need to add arguments with a hyphen (-, dash, minus sign)

open -a /Applications/Beyond\ Compare.app "$6" "$7" -title1="$3" -title2="$5" -readonly

But when I do that, the open command interprets the hyphens as flags for itself and exits with:

open: invalid option -- i
usage: ...

I tried "quoting" the entire command or - escaping the options. What should I do to get the extra functionality?

Hennes
  • 65,804
  • 7
  • 115
  • 169
Luc Bloom
  • 123

1 Answers1

1

See the open manpage :

 --args
     All remaining arguments are passed to the opened application in the argv parameter to
     main(). These arguments are not opened or interpreted by the open tool.

So, your command would look like:

open -a /Applications/Beyond\ Compare.app "$6" "$7" --args -title1="$3" -title2="$5" -readonly
chaos
  • 4,304