folder="/usr/share/fonts/*" extension="ttf" i=0 for file in $folder #/usr/share/fonts/opentype/* do for picked in "$file"/* do if [[ $picked == *"$extension"* ]]; then array[$i]="$picked" ((i++)) fi done done sorted=(`printf "%s\n" "${array[@]}" | sort -ft/ -k6`) count=${#sorted[@]} #Array is 0 to count # output to Fonts.html echo "" > Fonts.html # creates new file or overwrites existing file echo "" >> Fonts.html # rest of the lines append to the Fonts.html file echo "" >> Fonts.html echo "
" >> Fonts.html echo "${j}. ${t1} | ABCDEFGHIJKLMNOPQRSTUVWXYZ |