Pipe command with sudo
<p>I have a script which run this command successfully. I am using this command in another script which gives me error on this line (<code>.md5: Permission denied</code>).</p>

<p>I am running the previous script with sudo.</p>

<pre><code>for i in ${NAME}*
do
    sudo md5sum $i | sed -e "s/$i/${NAME}/" &gt; ${NAME}.md5${i/#${NAME}/}
done
</code></pre>