Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on bash script for font file name substitution #5

Open
rtauziac opened this issue Mar 24, 2023 · 1 comment
Open

Error on bash script for font file name substitution #5

rtauziac opened this issue Mar 24, 2023 · 1 comment

Comments

@rtauziac
Copy link

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:]')
@badalsaibo
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants