Add pipefail to generated user scripts

Add pipefail for better behaviour when users use pipes in their bash commands
 http://petereisentraut.blogspot.ca/2010/11/pipefail.html