我试图在从 ssh 注销后继续运行命令。我使用了命令nohup source a.sh > a.txt
和screen source a.sh > a.txt
.但两者都给出
nohup: failed to run command 'source': No such file or directory```
error. In one question, it is said that use the absolute path of command but I couldn't find the exact location of source command. But I can use nohup directly with other commands such as cp. How can I solve this issue or are there better alternatives?
答案1
为什么要用“来源”?只要这样做...
chmod 700 a.sh
nohup ./a.sh > a.txt &
在 a.sh 中,请确保您已指定应使用的 shell 作为解释器。 (即#!/bin/sh)