I have a question about syntax of bash regarding launching scripts from within bash script.
My questions are:
I've seen the following syntax:
#!/bin/bash python do_something.py > /dev/null 2>&1 &Can you please explain what is directed to
/dev/null, and what is the meaning of2>&1if before already mentioned/dev/null?In addition if I have a line defined like:
python do_something.py > 2>&1 &how is that different?
If I have the same python file in many paths, how can I differentiate between each process after launching
ps -ef |grep python. When I'm doing so, I get a list of processes which are all calleddo_something.py, it would be nice if I could have the full execution path string of each pid; how can I do that?
NOTE: The python file launched is writing its own log files.
: > 2>&1 &generates-bash: syntax error near unexpected token `2'— it is deemed invalid because there is no filename for the>redirection. That wasn't what I expected; I thought the file name would be the2>&1hieroglyph. (The:is a standard shell (built-in) command that does nothing successfully, assuming its arguments and I/O redirections were successful.)