正如标题所说,我想发送一个运行函数到后台。类似于在bash中发送一个运行函数到背景
function myfunc {
some_command | while read line
#some_command must be running indefinitely
do
#if some condition on ${line} satisfies
#Do something and go to background
done
}
这可能吗?
我知道有可能直接调用函数&直接在后台运行它。这很明显。这不是this的重复。
[在从脚本后台执行外壳命令]的可能的复制(HTTPS://计算器.com/questions/3683910 /执行命令在后台从脚本) – Aserre
你为什么要这样做?你可以调用你的函数形式为一个单独的bash脚本,并用&符号来调用它。然后你的功能在后台运行。 – schorsch312
为什么不'而真实;如果...;然后do_something&break; fi' –