What is the difference of sudo bash and sudo command in bash file?
<p>I would like to append some commands to ${HOME}/.bashrc file.</p>

<p>I made a script to do it.</p>

<pre><code># file name : setup_bash
bashrc_path="${HOME}/.bashrc"
comment="test"
sudo echo "${comment}" &gt;&gt; "${bashrc_path}"
</code></pre>

<p>and run it by</p>

<pre><code>bash setup_bash
</code></pre>

<p>And it results in an error.</p>

<pre><code>setup_bash: line 19: /home/user/.bashrc: Permission denied
</code></pre>

<p>line 19 is at (sudo echo ...).</p>

<p>Next I tried the following code,</p>

<pre><code>sudo bash setup_bash
</code></pre>

<p>It results in success.</p>

<p>What is the difference of them? Please teach me it.</p>