Safely piping to a shell script