react-native-font-demo
react-native-font-demo copied to clipboard
Error on bash script for font file name substitution
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:]')
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