From 981bd8992c39c662dcb3f4e3f2db192f807ddb6e Mon Sep 17 00:00:00 2001 From: lhess2021 Date: Fri, 4 Mar 2022 05:48:56 -0500 Subject: [PATCH] canto num edits --- shell-scripts.d/top-level-tags.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/shell-scripts.d/top-level-tags.sh b/shell-scripts.d/top-level-tags.sh index 65c00b2..060a6e7 100755 --- a/shell-scripts.d/top-level-tags.sh +++ b/shell-scripts.d/top-level-tags.sh @@ -10,14 +10,15 @@ echo -e "\nAdding top-level tags." for file in *; do if [[ "$file" != 'top-level-tags.sh' ]]; then - CANTO_NUM="$(echo "'$file'" | tr -d -c 0-9)" # get canto number - if [[ "$file" == inferno* ]]; then + CANTO_NUM_UNSAFE="$(echo "'$file'" | tr -d -c 0-9)" # get canto number + CANTO_NUM=$((10#$CANTO_NUM_UNSAFE)) # safe for bash (no octal 0xx) + if [[ "$file" == *inferno* ]]; then CANTICLE="Inferno" COMM_NUM="$CANTO_NUM" # same as inferno canto number - elif [[ "$file" == purgatorio* ]]; then + elif [[ "$file" == *purgatorio* ]]; then CANTICLE="Purgatorio" COMM_NUM="$((CANTO_NUM + 34))" # add 34 if in purgatory - elif [[ "$file" == paradiso* ]]; then + elif [[ "$file" == *paradiso* ]]; then CANTICLE="Paradiso" COMM_NUM="$((CANTO_NUM + 67))" # add 68 if in paradise else @@ -44,7 +45,5 @@ do echo -e "\t\t" >> "$file" echo -e "\t" >> "$file" echo -e "" >> "$file" - # Add a `.xml` extension - mv "$file" "$file.xml" fi done