#!/bin/sh
# mkscript -- create a new shell script with boilerplate
set -eu
if [ -z "${1:-}" ]; then
echo "Usage: mkscript <name>" >&2
exit 1
fi
name="$1"
if [ -f "$name" ]; then
echo "File already exists: $name" >&2
exit 1
fi
cat > "$name" << 'EOF'
#!/bin/sh
set -eu
main() {
echo "hello"
}
main "$@"
EOF
chmod +x "$name"
echo "[+] Created $name"