mirror of https://github.com/ericonr/dotfiles.git
25 lines
339 B
Bash
Executable File
25 lines
339 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# script to automate generation of executable shell scripts
|
|
|
|
FILE="$1"
|
|
SHELL="$2"
|
|
|
|
if [ -z "$FILE" ]
|
|
then
|
|
echo "No file name specified."
|
|
exit
|
|
fi
|
|
|
|
if [ -e "$FILE" ]
|
|
then
|
|
echo "File already exists."
|
|
exit
|
|
fi
|
|
|
|
printf "#!/bin/%s\n\n\n" "${SHELL:-sh}" > "$FILE"
|
|
|
|
touch "$FILE"
|
|
chmod +x "$FILE"
|
|
exec "${EDITOR:-nvim}" "$FILE" '+$'
|