簡體   English   中英

在 shell 腳本中運行服務器后,如何運行另一個命令?

[英]How can I run another command after running a server in a shell script?

在從 Ubuntu 框上的 shell 腳本運行 Node.js 服務器后,我想運行另一個命令,但第二個命令永遠不會啟動。

node server.js
xdg-open index.html

我該如何解決?

您可以在package.json中添加開始>>

{
  "name": "example",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node server.js && xdg-open index.html"
  },
  "dependencies": {
  },
  "devDependencies": {
  }
}

並使用npm 開始運行

參見: npm 腳本

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM