Browse Source

remove bash octal errors

main
lhess2021 4 years ago
parent
commit
693e2d27eb
  1. 11
      shell-scripts.d/top-level-tags.sh

11
shell-scripts.d/top-level-tags.sh

@ -9,18 +9,19 @@ echo -e "\nAdding top-level tags."
for file in *; for file in *;
do do
if [[ "$file" != 'top-level-tags.sh' ]]; then if [[ "$file" != 'top-level-tags.sh' ]] && [[ "$file" != 'canticle-to-xml.sh' ]]; then
CANTO_NUM_UNSAFE="$(echo "'$file'" | tr -d -c 0-9)" # get canto number ZEROS_CANTO_NUM="$(echo "'$file'" | tr -d -c 0-9)" # get canto number
CANTO_NUM=$((10#$CANTO_NUM_UNSAFE)) # safe for bash (no octal 0xx) #CANTO_NUM="$(echo $ZEROS_CANTO_NUM | tr -d 0)"
CANTO_NUM=$((10#$ZEROS_CANTO_NUM))
if [[ "$file" == *inferno* ]]; then if [[ "$file" == *inferno* ]]; then
CANTICLE="Inferno" CANTICLE="Inferno"
COMM_NUM="$CANTO_NUM" # same as inferno canto number COMM_NUM="$CANTO_NUM" # same as inferno canto number
elif [[ "$file" == *purgatorio* ]]; then elif [[ "$file" == *purgatorio* ]]; then
CANTICLE="Purgatorio" CANTICLE="Purgatorio"
COMM_NUM="$((CANTO_NUM + 34))" # add 34 if in purgatory COMM_NUM="$(($CANTO_NUM + 34))" # add 34 if in purgatory
elif [[ "$file" == *paradiso* ]]; then elif [[ "$file" == *paradiso* ]]; then
CANTICLE="Paradiso" CANTICLE="Paradiso"
COMM_NUM="$((CANTO_NUM + 67))" # add 68 if in paradise COMM_NUM="$(($CANTO_NUM + 67))" # add 68 if in paradise
else else
echo -e "\nWhat file is this? $file" echo -e "\nWhat file is this? $file"
fi fi

Loading…
Cancel
Save