title: bash diff return 0 when with 'sh -c'
body: <p>I was trying to diff some files, and do something if is different.
  But when combining with sh -c, diff can not return proper exit code.</p>
  
  <pre><code>root@i-qqixe8m2:~# cat /tmp/1
  1
  root@i-qqixe8m2:~# cat /tmp/2
  2
  root@i-qqixe8m2:~# set +x # Edited: useless cmd. But still kept here since answer below by @iBug would refer to this.
  root@i-qqixe8m2:~# sh -c "diff /tmp/1 /tmp/2; echo $?;"
  1c1
  &lt; 1
  ---
  &gt; 2
  0
  root@i-qqixe8m2:~# diff /tmp/1 /tmp/2; echo $?;
  1c1
  &lt; 1
  ---
  &gt; 2
  1
  root@i-qqixe8m2:~#
  </code></pre>
  
  <p>PS. I found related question here: <a href="https://stackoverflow.com/questions/43748835/git-diff-and-bash-return-code">git diff and bash return code</a>, but no reason provided, and comments below I believe is not the real right solution, since I don't use git here.</p>