在vm中的新终端窗口中运行进程

问题描述 投票:0回答:1

我想知道-是否有可能使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以外的任何软件上进行测试,但是...

  • 拥有在跨平台上也可以使用的功能非常好。
  • 是否有可能继承相同的终端窗口设置(即在终端中打开新标签页,而不是打开默认的单独终端窗口...
  • 并且知道如何使用至少在终端中可以通过command + shift + down激活的“替代窗口”是理想的……理想地以一种可靠的方式
  • 我也应该说-现在(至少),我现在需要返回BACK到原始终端窗口,而让另一个窗口在后台运行,所以我不想使用-s。

我也尝试了以下无法使用的内容,但对于其他想从他们的脚本打开终端窗口的人来说可能是有用的参考...

osascript -e 'tell app "Terminal" to do script "cd ~/somewhere"'
gnome-terminal # not found
xterm # not found
konsole # not found
bash shell terminal vagrant virtual-machine
1个回答
0
投票

您可以阅读https://unix.stackexchange.com/a/253531,但是open是Mac-os特定的命令,在您的VM中没有等效的命令,您无法精确确定正在运行的命令(ubuntu,centos ....]

您真正想实现什么?如果要运行脚本来安装软件,则只需调用该脚本即可。

© www.soinside.com 2019 - 2024. All rights reserved.