title: bash: override echo to print a custom prefix in a script
body: <p>I have some lengthy scripts calling each other and I want their output to be more descriptive. The idea is to customize the echo command for each script with something like below.</p>
  
  <p>My question is, how to make it non recursive, using <code>echo</code>? </p>
  
  <p>this is script1.sh</p>
  
  <pre><code>#!/bin/bash
  #Original version:
  #function echo(){ echo $(basename $0 .sh): $1; }
  #Version after fixes
  function echo(){ builtin echo -n "$(basename $0 .sh): "&gt;&amp;2; builtin echo $@ ; } 
  echo Info
  ./script2.sh
  </code></pre>
  
  <p>this is script2.sh</p>
  
  <pre><code>#!/bin/bash
  #Original version:
  #function echo(){ echo $(basename $0 .sh): $1; }
  #Version after fixes
  function echo(){ builtin echo -n "$(basename $0 .sh): "&gt;&amp;2; builtin echo $@ ; } 
  echo Info
  exit 0
  </code></pre>
  
  <p>so the output should be:</p>
  
  <pre><code>&gt;./script1.sh
  script1: Info
  script2: Info
  </code></pre>
  
  <p>--- EDIT</p>
  
  <p>Bonus:</p>
  
  <pre><code>&gt;./script1.sh 2&gt; /dev/null 
  Info
  Info
  </code></pre>