Home how to pass command-line arguments to a program run with the open command?
Reply: 0

how to pass command-line arguments to a program run with the open command?

user1129
1#
user1129 Published in May 20, 2018, 10:14 am

Is there a way to pass arguments to a program being run via:

open -a /Applications/Utilities/Terminal.app ~/my_executable

I have tried:

open -a /Applications/Utilities/Terminal.app ~/my_executable arg1 arg2

But this is interpreted as telling the terminal to open ~/my_executable ~/arg1 ~/arg2.

I have tried:

open -a /Applications/Utilities/Terminal.app '~/my_executable arg1 arg2'

But it picks up arg1 and arg2 as if they were part of the path rather than arguments.

I have tried:

open -a /Applications/Utilities/Terminal.app ~/my_executable | xargs arg1 arg2

I have also tried:

open -a /Applications/Utilities/Terminal.app ~/my_executable --args arg1 arg2

But with that flag, args are passed to the terminal.

NOTE

I am only allowed to change the arguments to Terminal.app (the part within [ ]):

open -a /Applications/Utilities/Terminal.app [~/my_executable arg1 arg2]
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.38862 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO