debugging spacemall
authorChris Koeritz <fred@gruntose.com>
Tue, 12 Feb 2019 15:11:44 +0000 (10:11 -0500)
committerChris Koeritz <fred@gruntose.com>
Tue, 12 Feb 2019 15:11:44 +0000 (10:11 -0500)
working better but still something screwy about matching pdf files

scripts/files/renlower.pl
scripts/files/spacem.sh

index 1fe9fa1ff27490ac9851b305cc25cc3ec4ccaa4f..ca42de7c3fb0889ec02b3aa3287a65fa4e709d16 100644 (file)
@@ -45,9 +45,10 @@ sub rename_lower {
 #print "new name='$new_name'\n";
       local $intermediate_name = $dir . "RL" .  rand() . ".tmp";
 #print "\n";
-print "command A is: rename [$old_name] [$intermediate_name]\n";
-print "command B is: rename [$intermediate_name] [$new_name]\n";
-print "\n";
+
+#print "command A is: rename [$old_name] [$intermediate_name]\n";
+#print "command B is: rename [$intermediate_name] [$new_name]\n";
+#print "\n";
       rename($old_name, $intermediate_name)
           || die "failed to do initial rename";
       rename($intermediate_name, $new_name)
index aecf3b085886017e3182a44482f3c4aad95ec28b..9b201c5cfb240fb5eaf5c0fa4d6f9ab2e55cf3bc 100644 (file)
@@ -10,32 +10,37 @@ echo "arg is '$arg'"
       continue
     fi
 
-    # first we will capture the output of the character replacement operation for reporting.
+    # we capture the output of the character replacement operation for reporting.
     # this is done first since some filenames cannot be properly renamed in perl (e.g. if they
     # have pipe characters apparently).
     intermediate_name="$(bash "$FEISTY_MEOW_SCRIPTS/files/replace_spaces_with_underscores.sh" "$arg")"
     local saw_intermediate_result=0
     if [ -z "$intermediate_name" ]; then
+echo no new intermed name reported
       # make sure we report something, if there are no further name changes.
       intermediate_name="'$arg'"
     else 
       # now zap the first part of the name off (since original name is not needed).
-      intermediate_name="$(echo "$intermediate_name" | sed -e 's/.*=> //')"
+      intermediate_name="$(echo $intermediate_name | sed -e 's/.*=> //')"
       saw_intermediate_result=1
     fi
 
-    # first we rename the file to be lower case.
-    actual_file="$(echo "$intermediate_name" | sed -e "s/\'\([^']*\)\'/\1/")"
+    # here we rename the file to be lower case.
+    actual_file="$(echo $intermediate_name | sed -e "s/'\([^']*\)'/\1/")"
+echo actual file computed: $actual_file
     final_name="$(perl "$FEISTY_MEOW_SCRIPTS/files/renlower.pl" "$actual_file")"
     local saw_final_result=0
+echo temp final name is: $final_name
     if [ -z "$final_name" ]; then
       final_name="$intermediate_name"
     else
-      final_name="$(echo "$final_name" | sed -e 's/.*=> //' )"
+      final_name="$(echo $final_name | sed -e 's/.*=> //' )"
       saw_final_result=1
     fi
-#echo intermed=$saw_intermediate_result 
-#echo final=$saw_final_result 
+echo intermed result=$saw_intermediate_result 
+echo intermed name=$intermediate_name
+echo final result=$saw_final_result 
+echo final name=$final_name
 
     if [[ $saw_intermediate_result != 0 || $saw_final_result != 0 ]]; then
       # printout the combined operation results.
@@ -47,9 +52,10 @@ echo "arg is '$arg'"
 # this block should execute when the script is actually run, rather
 # than when it is just being sourced.
 if [[ $0 =~ .*spacem\.sh.* ]]; then
+echo inside exec block for spacem
   source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
   exit_on_error "sourcing the feisty meow environment"
   spacem_out "${@}"
-  exit_on_error "running spacem_out on a list: $*"
+  exit_on_error "running spacem_out on a list: ${@}"
 fi