Last active
March 31, 2021 20:02
-
-
Save sgobotta/c554baf1066297baa28b5962b5e43c2e to your computer and use it in GitHub Desktop.
Simple script to copy fonts into Ubuntu's default fonts directory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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