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 *;
do
if [[ "$file" != 'top-level-tags.sh' ]]; 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" != 'top-level-tags.sh' ]] && [[ "$file" != 'canticle-to-xml.sh' ]]; then
ZEROS_CANTO_NUM="$(echo "'$file'" | tr -d -c 0-9)" # get canto number
#CANTO_NUM="$(echo $ZEROS_CANTO_NUM | tr -d 0)"
CANTO_NUM=$((10#$ZEROS_CANTO_NUM))
if [[ "$file" == *inferno* ]]; then
CANTICLE="Inferno"
COMM_NUM="$CANTO_NUM" # same as inferno canto number
elif [[ "$file" == *purgatorio* ]]; then
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
CANTICLE="Paradiso"
COMM_NUM="$((CANTO_NUM + 67))" # add 68 if in paradise
COMM_NUM="$(($CANTO_NUM + 67))" # add 68 if in paradise
else
echo -e "\nWhat file is this? $file"
fi

Loading…
Cancel
Save