Cleaned up some scripts

This commit is contained in:
2021-12-30 20:55:40 -05:00
parent 670554b369
commit b380cb1190
3 changed files with 9 additions and 4 deletions

View File

@@ -1,6 +1,5 @@
#!/bin/sh
for file in "$SCREENSHOTS"/*; do
echo "Removing file: $file" >&2
rm "$file"
done

View File

@@ -6,9 +6,13 @@
test ! -n "${SCRIPTS}" && echo "SCRIPTS not set" && exit 1;
# fallback to check if the name arg ${1} exists, if not show usage text.
test ! -n "${1}" && echo "usage: newscript <name>" && exit 1;
test ! -n "${1}" && \
echo "usage: newscript <name> <optional: shell>" && \
echo "shell defaults to `sh` if not supplied" && \
exit 1;
path="${SCRIPTS}/${1}"
shell="${2:-sh}"
if [ -e "${path}" ]; then
read -p "${1} already exists. Edit? " yes
@@ -18,7 +22,7 @@ if [ -e "${path}" ]; then
exit 0
fi
printf "#!/bin/sh\n\n" > "${path}"
printf "#!/bin/${shell}"\n\n" > "${path}"
chmod +x "${path}"
exec vim +2 "${path}"