Created
March 15, 2016 12:53
-
-
Save Boldewyn/3bd7ae2ff681a5e06194 to your computer and use it in GitHub Desktop.
Small script to install a font under Linux by means of symlinking to it
This file contains 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
#!/bin/bash | |
ERROR=0 | |
mkdir -p "$HOME/.fonts" | |
for name in "$@"; do | |
if [[ ! -f $name ]]; then | |
echo "Can't find $name" >&2 | |
ERROR=1 | |
continue | |
elif [[ -f $HOME/.fonts/$(basename "$name") ]]; then | |
echo "A font named $(basename "$name") already exists" >&2 | |
ERROR=2 | |
continue | |
fi | |
FONT="$(readlink -fn "$name")" | |
ln -s "$FONT" "$HOME/.fonts/$(basename "$name")" | |
done | |
mkfontscale "$HOME/.fonts" | |
mkfontdir "$HOME/.fonts" | |
fc-cache -f "$HOME/.fonts" | |
exit $ERROR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment