sistema_progs

Programas para customizar o meu entorno de traballo nos meus equipos persoais
Log | Files | Refs

print_icons.sh (645B)


      1 #!/usr/bin/env bash
      2 
      3 YELLOW='\033[1;33m'
      4 GREEN='\033[0;32m'
      5 NC='\033[0m'
      6 filename="./build/mapping.txt"
      7 count=0
      8 
      9 while read -r line
     10 do
     11     if [ "${line:0:1}" = "#" ]
     12     then
     13 	name_num=(${line//:/ })
     14 	echo -e "\n${YELLOW}${name_num[0]:1} (${name_num[1]} glyphs)${NC}:"
     15 	count=$((count + name_num[1]))
     16     else
     17 	str=""
     18 	IFS=';' read -ra array_glyph <<< "$line"
     19 	for glyph in "${array_glyph[@]}"; do
     20 	    info=(${glyph//:/ })
     21 	    if [ $# -gt 0 ]; then
     22 		str="$str${info[0]}: \u${info[1]}\n"
     23 	    else
     24 		str="$str \u${info[1]}"
     25 	    fi
     26 	done
     27 	echo -e $str | sed 's/ /  /g'
     28     fi
     29 done < "$filename"
     30 
     31 echo -e "\n${GREEN}Total: $count glyphes${NC}"