I understand > /dev/null
redirects things to /dev/null
which acts like a blackhole. However, I don't understand what < /dev/null
means. I saw some script written like this:
nohup myprogram > foo.out 2> foo.err < /dev/null &
So, what does < /dev/null
in the code above mean?
here's an example where it's suggested
Best Answer
It ensures that all I/O streams are accounted-for/occupied.
This way, the backgrounded process has nothing "tied" to the terminal so you can go about your business without your program trying to read from TTY, which would cause the terminal to hang.
In this case, since you're launching the process over ssh from a shell script, it's making sure that the script can move along unencumbered.