Open Terminal window and pre-populate with command
问题 Is it possible to use the open command to open a Terminal window and pass it an argument to pre-populate the new window with a specific command? 回答1: Like this, but using osascript rather than open : osascript -e 'tell app "Terminal" to do script "ls -l"' If you want to use a bash variable in the script, do something like this: BASHVAR="hello" osascript<<EOF tell app "Terminal" to do script "echo $BASHVAR" EOF 来源: https://stackoverflow.com/questions/32441603/open-terminal-window-and-pre