install-font-nerd-fonts.sh 574 B

1234567891011121314151617181920212223
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. if [[ $EUID -ne 0 ]]; then
  4. echo run as sudo!
  5. echo "sudo ${0}"
  6. exit 2
  7. fi
  8. # latest=$(curl -I https://github.com/ryanoasis/nerd-fonts/releases/latest | grep 'location: ' | tr -d '\r')
  9. # latest_tag="${latest##*/}"
  10. font_names=(Gohu NerdFontsSymbolsOnly)
  11. cd /usr/share/fonts
  12. for font in "${font_names[@]}"; do
  13. archive="${font}.zip"
  14. link="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/${archive}"
  15. wget -c "$link"
  16. unzip "$archive" -d "$font"
  17. done
  18. rm -rf ./*.zip
  19. fc-cache -vf