How to assign output of compare command to a variable <p>i have a problem with compare command.</p> <p>I use this to output result to screen, but I receive nothing ( echo is empty ) but after executing command I obtain a numeric value</p> <p></p> <pre><code>COMP=`compare -metric PSNR 00000003.jpg 00000004.jpg difference.png`&lt;br&gt; echo "$COMP" </code></pre> <p> <br></p> <p>I tried this:<br> </p> <pre><code>OUTPUT="$(compare -metric PSNR 00000003.jpg 00000004.jpg difference.png)" echo "${OUTPUT}" </code></pre> <p> But it doesn't help</p>