Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing arguments with "open -a Terminal"

Tags:

bash

macos

It seems like it's a very stupid question.
I'm trying to open a bash-file with (another) Terminal inside a bash-file, providing two arguments.

Something like this:

open -a Terminal path/to/file.sh ARG1 ARG2

I tried something like that, which gives me no errors but simply doesn't provide the arguments:

open -a Terminal path/to/file.sh --args ARG1 ARG2

Can someone help me?

like image 703
user2839873 Avatar asked Oct 15 '25 07:10

user2839873


1 Answers

I think you mean this:

osascript -e 'tell application "Terminal" to do script "date +s"'

or this with arguments:

osascript -e 'tell application "Terminal" to do script "echo 'arg2' 'arg2'"'

Or this way of working may suit better:

osascript<<EOF
tell application "Terminal"
    do script "yourScript $1 $2"
end tell
EOF
like image 125
Mark Setchell Avatar answered Oct 17 '25 03:10

Mark Setchell



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!