Nohup Command – How to Execute Multiple Commands Using Nohup

command linenohupshell

I need to execute multiple commands using nohup. Each command should be executed after the previous command.

I used this command as an example:

nohup wget $url && wget $url2 > /dev/null 2>&1 &

However that command did not work.

What command should I use for this purpose?

Best Answer

Wrap it in sh -c:

nohup sh -c 'wget "$0" && wget "$1"' "$url1" "$url2" > /dev/null &
Related Question