Launching scripts from bash and directing outputs
<p>I have a question about syntax of bash regarding launching scripts from within bash script.</p>

<p>My questions are:   </p>

<ol>
<li><p>I've seen the following syntax:</p>

<pre><code>#!/bin/bash
python do_something.py &gt; /dev/null 2&gt;&amp;1 &amp;
</code></pre>

<p>Can you please explain what is directed to <code>/dev/null</code>, and what is the meaning of <code>2&gt;&amp;1</code> if before already mentioned <code>/dev/null</code>?</p></li>
<li><p>In addition if I have a line defined like:</p>

<pre><code>python do_something.py &gt; 2&gt;&amp;1 &amp;
</code></pre>

<p>how is that different?</p></li>
<li><p>If I have the same python file in many paths, how can I differentiate between each process after launching <code>ps -ef |grep python</code>.
When I'm doing so, I get a list of processes which are all called <code>do_something.py</code>, it would be nice if I could have the full execution path string of each pid; how can I do that?</p></li>
</ol>

<p><strong>NOTE:</strong> The python file launched is writing its own log files.</p>

<p>1) stdout (Standard Output) is redirected to /dev/null and stderr (error messages) is redirected to standard output i.e console. </p>

<ul>
<li>1>filename : Redirect stdout to file "filename."</li>
<li>1>>filename: Redirect and append stdout to file "filename."</li>
<li>2>filename : Redirect stderr to file "filename."</li>
<li>2>>filename: Redirect and append stderr to file "filename."</li>
<li>&amp;>filename : Redirect both stdout and stderr to file "filename."</li>
</ul>

<p>3) Using the <strong>ps auxww</strong> flags, you will see the full path to output in both your terminal window and from shell scripts. "ps manual":</p>

<p>-w         Wide output. Use this option twice for unlimited width.</p>

python linux bash