For some reason the following will result in an endless loop under bash-4.3.42: while([ -h "${SCRIPT_PATH}" ]) Just remove the round brackets (parentheses) to fix the issue. They're not needed anyway.
Needed to allow arguments to be passed to the node engine, which isn't possible if red.js is run with a #! line.