NeutronStar
NeutronStar

Reputation: 2157

Can I use nohup on a shell script rather than a specific command?

If I have a shell script named shell.sh can I enter this at the command line:

$ nohup shell.sh

and the script will run to completion even if I log out? Or do I need to nohup every line in the script?

Upvotes: 0

Views: 91

Answers (1)

that other guy
that other guy

Reputation: 123450

Yes. Do whatever you do to normally run the script, just put nohup in front of it.

If you normally run shell.sh, then yes, you can run nohup shell.sh.

If you instead do ./shell.sh you should nohup ./shell.sh.

Upvotes: 1

Related Questions