Skip to content

Instantly share code, notes, and snippets.

@sgobotta
Last active March 31, 2021 20:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sgobotta/c554baf1066297baa28b5962b5e43c2e to your computer and use it in GitHub Desktop.
Save sgobotta/c554baf1066297baa28b5962b5e43c2e to your computer and use it in GitHub Desktop.
Simple script to copy fonts into Ubuntu's default fonts directory
#!/usr/bin/bash
FOLDER_NAME=$1
FONTS_DIR=$2
DEFAULT_FONTS_DIR=~/.local/share/fonts
if [[ -z "$FOLDER_NAME" ]]; then
echo "Empty fonts source directory provided. Usage: copy-font.sh <folder-name>"
exit 1
fi
if [[ -d "$FOLDER_NAME" ]]; then
echo "Reading from $FOLDER_NAME..."
else
echo "Error: ${DIR} not found. The first argument must be a fonts directory."
exit 1
fi
if [[ -z "$FONTS_DIR" ]]; then
echo "Empty fonts target directory provided. Using default fonts directory '$DEFAULT_FONTS_DIR'."
fi
cp -r $FOLDER_NAME $DEFAULT_FONTS_DIR
echo "The following files were copied:"
echo ""
echo $(ls $FOLDER_NAME)
echo ""
echo "Exiting."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment