removed squish dirs code to squish current
authorFred Hamster <fred@gruntose.com>
Fri, 25 Apr 2025 11:06:14 +0000 (07:06 -0400)
committerFred Hamster <fred@gruntose.com>
Fri, 25 Apr 2025 11:06:14 +0000 (07:06 -0400)
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

index a9f3b0e87828c82bea2a8312a148c5b85c400b88..4aa13dd6ff4386bd0d38aae972ecff450d9d702a 100644 (file)
@@ -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