#!/bin/sh set -e echo " Setting workdir from current dir, which is $(pwd) " if [ -n "$2" ]; then cd "./$2" fi echo " Running node script $1 " node $1 >/tmp/log.txt || command_failed=1 if [ ${command_failed:-0} -eq 1 ]; then cat /tmp/log.txt echo " ==> Command has failed. See log above " exit 1 else echo "Compile successful, log omitted" fi