getfontdirs() { for i in /etc/X11/xorg.conf-4 /etc/X11/xorg.conf /etc/xorg.conf do if [[ -a "${i}" && -f "${i}" ]]; then grep -v "^#" ${i} | while read a b c d do if [ "${a}" = "FontPath" ]; then g=${b#\"} f=${g%\"} echo ${f%:unscaled}fonts.dir fi done return fi done } getfontdirs | sort | uniq | while read i do if [[ -a "${i}" && -f "${i}" ]]; then echo $i fi done