react-native-font-demo icon indicating copy to clipboard operation
react-native-font-demo copied to clipboard

Error on bash script for font file name substitution

Open rtauziac opened this issue 2 years ago • 1 comments

I am facing an issue when executing the bash script for substituting dashes and capitals in font file names for Android.

${normalized,,}: bad substitution

After some research, I found that it was due to my bash version that was under version 4.

I am on a Macbook pro M1 and the bash shell is at version 3.2.57.

You can replace the previous code with the following line:

normalized=$(echo "$normalized" | tr '[:upper:]' '[:lower:]')

rtauziac avatar Mar 24 '23 09:03 rtauziac

updated fixfonts.sh

#!/bin/bash
# fixfonts.sh

typeset folder="$1"
if [[ -d "$folder" && ! -z "$folder" ]]; then
  pushd "$folder";
  for file in *.ttf; do
    typeset normalized="${file//-/_}";
    normalized=$(echo "$normalized" | tr '[:upper:]' '[:lower:]');
    mv "$file" "$normalized"
  done
  popd
fi

badalsaibo avatar Oct 12 '23 12:10 badalsaibo