sistema_progs

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

colors_env.sh (602B)


      1 #!/usr/bin/env sh
      2 
      3 _PATH="/usr/include"
      4 
      5 scheme="$(grep "#define" "$_PATH/gcolors.h" | awk '{print $2}' | tr '[:upper:]' '[:lower:]')"
      6 sch_file="$_PATH/gcolors/$scheme.h"
      7 
      8 grep "#define" "$sch_file" > /tmp/color_list
      9 while read line
     10 do
     11     key="$(echo "$line" | awk '{print $2}')"
     12     value="$(echo "$line" | awk '{print $3}' | sed s/\"//g)"
     13 
     14     # resolve referencies
     15     while ! [ "$(echo "$value" | cut -c1-1)" = "#" ]
     16     do
     17         value="$(grep "#define $value" "$sch_file" | awk '{print $3}' | sed s/\"//g)"
     18     done
     19 
     20     # finally export color
     21     export "$key"="$value"
     22 done < /tmp/color_list