title: How to view bash commands when executed from a node script
body: <p>I have a node app where I'm using a webhook from bitbucket to trigger a bash script to run some commands to deploy my app. It works, however I can't view any of the commands being run (ie progress commands echo'd). How can I achieve this?</p>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>  var shellPath = path.join(__dirname + '../../deploy/deploy.sh');
    var exec = require('child_process').exec;
  
    function puts(error, stdout, stderr) {
      console.log('stout: ', stdout)
      console.log('error: ', error)
      console.log('stderr: ', stderr)
    }
  
    exec(shellPath, puts);
  </code></pre>
  
  <p>deploy.sh -</p>
  
  <pre><code>echo Preparing to Git Fetch
  git reset --hard origin/master
  echo Preparing to clean
  git clean -f
  echo Preparing to pull
  git pull
  echo preparing to pull
  npm i --production
  echo preparing to restart pm2
  pm2 restart client-www
  echo Finished deploy
  </code></pre>