Call a function using nohup

前端 未结 6 1716
滥情空心
滥情空心 2020-12-10 10:59

I am trying to call a function using nohup like this:

function1(){
    while true 
    do
        echo \"function1\"
        sleep 1
    done
}
         


        
6条回答
  •  执念已碎
    2020-12-10 11:53

    I find a working solution for me - define the function in a file (e.g. .functions) then run the function with nohup:

    nohup bash -c "source .functions; function1" &

    Tested on Ubuntu 13.04.

提交回复
热议问题