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]
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…