正如標題所說,我想發送一個運行函數到後臺。類似於在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' –