我正在尝试让我的#!/bin/sh shell 脚本在不暂停执行的情况下启动另一个应用程序。那就是我正在寻找一种在后台启动它并让我的 shell 脚本继续执行的方法。我希望它像这样工作:
# start daemon
start(){
success=`launch '/path/to/daemon'`
if [ $success != false ];then
echo 'daemon is now running'
fi
我也是 shell 脚本的新手,所以上面的(如果启动存在)是否会得到启动的返回或stdout设置为 $success?
我只想使用 SH 而不是 BASH。
最佳答案
在程序名称后使用“&”符号可在后台启动它。 Putting a program in the background
关于sh - 你能在 shell 脚本中生成一个进程吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7133396/