Using pipes, one can create files with simple shell built-ins.
{ echo "#!/bin/bash" \
echo "echo Hello, World!" \
} > helloworld.sh
With chmod these can then be made executable.
$ chmod 755 helloworld.sh
$ ./helloworld.sh
Hello, World!
I wonder whether it is possible to save the chmod step. Already, I found that umask cannot do the job. But perhaps someone knows an environment variable, bash trick, program to pipe through or other neat way to do it.
Is it possible to have the file created with the executable bit already set?