mirror of
https://github.com/m-housh/dotfiles.git
synced 2026-02-14 06:12:34 +00:00
Cleaned up some scripts
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
for file in "$SCREENSHOTS"/*; do
|
||||
echo "Removing file: $file" >&2
|
||||
rm "$file"
|
||||
done
|
||||
|
||||
@@ -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}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user