title: How do I prevent bash to use a builtin command?
body: <p>I'm trying to fix a script that use <code>echo</code>, that is using the builtin command instead of the command, how can I prevent that?</p>
  
  <p>I know I can do <code>/bin/echo</code> to force the usage of that, but I wouldn't like to hardcode the path (for portability).</p>
  
  <p>I thought using something as:</p>
  
  <pre><code>$ECHO=`which echo`
  $ECHO -e "text\nhere"
  </code></pre>
  
  <p>but <code>which echo</code> returns: "echo: shell built-in command".</p>
  
  <hr>
  
  <p>I've ended up defining an <code>echo</code> function that uses <code>env</code> as @Kenster recommends. This way I don't need to modify the calls to echo in the script.</p>
  
  <pre><code>echo() {
    env echo $*
  }
  
  # the function is called before the built-in command.
  echo -en "text\nhere"
  </code></pre>