gpt4 book ai didi

linux bash终端功能不关闭命令

转载 作者:太空宇宙 更新时间:2023-11-04 11:50:40 28 4
gpt4 key购买 nike

#webstorm terminal window
alias webstorm='webstorm . &'
#function for opening and running AdminApp
ws(){ gnome-terminal -e webstorm && nohup && exit;};
aa(){ cd Desktop/code/AdminApp; ws; nodemon --exec npm start;};

我的 ide 是 webstorm,我想要完成的是有一个命令来 cd 以更正文件夹打开 ide,然后在本地运行服务器。出于某种原因,我无法关闭 ide 的终端,如果我手动关闭它,它就会关闭 ide。我也未能在一个终端上完成所有操作。

最佳答案

您正在以错误的方式使用 nohup gnome-terminal -e

使用 gnome-terminal -e webstorm && nohup && exit,您将在当前 shell 中执行三个命令:

  1. gnome-terminal -e webstorm
  2. nohup
  3. 退出

nuhop 只会在第一个命令成功退出时运行,但只要 webstorm 正在运行,这种情况就不会发生。If webstorm exits nohup starts, but that doesn't help you now anymore, especially since nohup expects a command as a argument and will fail 因为因为你没有提供。

别名 webstorm='webstorm 。 &' 您之前定义的对 gnome-terminal -e 没有影响,因为 -e 接受一个 string 参数并执行该字符串在另一个外壳中。你必须写出命令。

你可能想使用

ws() { nohup webstorm . & }

关于linux bash终端功能不关闭命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56147011/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com