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 #!/bin/sh
for file in "$SCREENSHOTS"/*; do for file in "$SCREENSHOTS"/*; do
echo "Removing file: $file" >&2
rm "$file" rm "$file"
done done

View File

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

View File

@@ -10,8 +10,10 @@ uid="$(id -u "$(whoami)")"
mkdir -p "$agent_dir" mkdir -p "$agent_dir"
for file in "${DOTFILES}"/macOS/LaunchAgents/*.plist; do for file in "${DOTFILES}"/macOS/LaunchAgents/*.plist; do
filename=$(basename "${file}") # get just the base file name, similar to using `basename` but w/o a subshell
filename="${file##*/}"
path="${agent_dir}/${filename}" path="${agent_dir}/${filename}"
echo "$filename"
if ! test -e "${path}"; then if ! test -e "${path}"; then
echo "Installing Agent: ${filename}" echo "Installing Agent: ${filename}"
cp "${file}" "${path}" cp "${file}" "${path}"