linux - linux bash终端功能未按命令关闭
问题描述
#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 中执行三个命令:
gnome-terminal -e webstorm
nohup
exit
nuhop
只会在第一个命令成功退出时运行,但只要webstorm
正在运行就不会发生。如果webstorm
exitsnohup
开始了,但这现在对您没有帮助,特别是因为nohup
期望命令作为参数并且由于您没有提供命令而将失败。
您之前定义的别名对aswebstorm='webstorm . &'
没有影响,它接受一个字符串参数并在另一个 shell 中执行该字符串。你必须写出命令。gnome-terminal -e
-e
您可能想使用
ws() { nohup webstorm . & }
推荐阅读
- python - 列表压缩打印 [none, none, none]
- c - 如何计算目录中存在的所有子目录?
- node.js - Typeorm 不在表中保存数据。如何在 typeorm 中进行迁移?
- python - 从 Google Cloud Build 发出授权请求
- angular - Angular/NGRX - 防止重复数据
- python-3.x - Python3中的LDAP查询
- scala - 优化加入两个 spark scala 数据帧的代码
- javascript - 使用 Fetch API 将 Django 模型属性传递给 JavaScript
- google-sheets - 获取列中这些单元格的总和小于指定值的单元格计数
- sql-server - Where 子句中的多值条件参数 - SSRS