我想知道-是否有可能使bash / shell进程在流浪汉VM的第二个终端窗口中运行?
在本地计算机上,我可以在bash脚本中运行以下命令...
open -a Terminal -n "`pwd`" ## To launch a new window in the same dir
open -a Terminal -n "`pwd`" script.sh ## To launch a new window and run a script...
Up弹出一个新窗口-不是具有相同的shell主题,但我可以接受。
但是,如果我跳入无业游民的盒子/ VM或尝试在无业游民提供期间运行它,则会出现以下错误:
open: invalid option -- 'a'
Usage: open [OPTIONS] -- command
This utility help you to start a program on a new virtual terminal (VT).
Options:
-c, --console=NUM use the given VT number;
-e, --exec execute the command, without forking;
-f, --force force opening a VT without checking;
-l, --login make the command a login shell;
-u, --user figure out the owner of the current VT;
-s, --switch switch to the new VT;
-w, --wait wait for command to complete;
-v, --verbose print a message for each action;
-V, --version print program version and exit;
-h, --help output a brief help message.
我可能需要在VM上安装一些东西-但是它识别出'Open'的事实意味着我不确定什么是最好的,或者帮助消息没有用处
我尝试过使用不同的选项-e等,但是找不到在VM环境中专门问这个问题的人。
未在Mac OS Catalina以外的任何软件上进行测试,但是...
我也尝试了以下无法使用的内容,但对于其他想从他们的脚本打开终端窗口的人来说可能是有用的参考...
osascript -e 'tell app "Terminal" to do script "cd ~/somewhere"'
gnome-terminal # not found
xterm # not found
konsole # not found
您可以阅读https://unix.stackexchange.com/a/253531,但是open
是Mac-os特定的命令,在您的VM中没有等效的命令,您无法精确确定正在运行的命令(ubuntu,centos ....]
您真正想实现什么?如果要运行脚本来安装软件,则只需调用该脚本即可。