相关疑难解决方法(0)

使用nohup调用函数

我试图nohup像这样调用一个函数:

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

nohup function1 & 
# ...... some other code
Run Code Online (Sandbox Code Playgroud)

但可能是看不到的功能nohup,我得到这个错误:

nohup: failed to run command `function1' : No such file or dictionary
Run Code Online (Sandbox Code Playgroud)

我不想为我的函数创建新的sh文件.我怎样才能解决这个问题?

linux bash shell function nohup

16
推荐指数
5
解决办法
2万
查看次数

标签 统计

bash ×1

function ×1

linux ×1

nohup ×1

shell ×1