#!/usr/bin/env sh

set -o errexit
set -o nounset

file="${1:-}"

[ -z "${file}" ] && { echo "Please supply a script name to create"; exit 1; }
[ -f "${file}" ] && { echo "${file} already exists, aborting"; exit 1; }

mkdir -p "$(dirname "${file}")"

cat > "${file}" << EOF
#!/bin/sh

set -o errexit
set -o nounset

echo "hello world"
EOF

chmod +x "${file}"
