From 92ff1fff8727047c882a0191c758e4054057838b Mon Sep 17 00:00:00 2001 From: Fred Hamster Date: Fri, 25 Apr 2025 07:06:14 -0400 Subject: [PATCH] removed squish dirs code to squish current if there were no parameters, it happily started squishing every directory in the current dir. i typed it accidentally with no parameters in my home directory, and it started squishing every freaking thing. not right. also, there was somehow data loss, even though this is supposed to zip first before removal. how did that happen? --- scripts/files/squish_directories.sh | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/scripts/files/squish_directories.sh b/scripts/files/squish_directories.sh index a9f3b0e8..4aa13dd6 100644 --- a/scripts/files/squish_directories.sh +++ b/scripts/files/squish_directories.sh @@ -14,15 +14,17 @@ dirs=() # snag the command line arguments into an array of names. for i in "$@"; do dirs+=("$i"); done -# if there were no arguments, use the current directories list of directories. +###NOOOOO# if there were no arguments, use the current directories list of directories. if [ ${#dirs[@]} -eq 0 ]; then - # using a temp file is clumsy but after a lot of different methods being tried, this one - # worked and wasn't super ugly. - tempfile="$(mktemp /tmp/dirlist.XXXXXX)" - find $dir -mindepth 1 -maxdepth 1 -type d -exec echo "dirs+=(\"{}\");" ';' >$tempfile - source "$tempfile" -#echo dirs default to: ${dirs[@]} - rm -f $tempfile + echo "No directories were specified; nothing will be squished." + exit 1 +## # using a temp file is clumsy but after a lot of different methods being tried, this one +## # worked and wasn't super ugly. +## tempfile="$(mktemp /tmp/dirlist.XXXXXX)" +## find $dir -mindepth 1 -maxdepth 1 -type d -exec echo "dirs+=(\"{}\");" ';' >$tempfile +## source "$tempfile" +###echo dirs default to: ${dirs[@]} +## rm -f $tempfile fi # takes a directory name as an argument and sucks the directory -- 2.34.1