was playing with Lemonbar and figured it would be nice of it were somehow possible to have it tie in, colourwise, with one's Xresources colourscheme. so I wanted a quick way to grab a colour from the Xresources to use it in my script. i figured i'd use grep, but some online searching led me to use sed instead, which can do the same basic thing as grep, namely find PATTERN in FILE.
Code: Select all
sed -n "/*color4:/s/*color4://p" ~/.Xresources | tr -d [:blank:]
Code: Select all
xcolors=$(sed -n "/#include/s/#include//p" ~/.Xresources | sed "s/<\(.*\)>/\1/")
mycolor=$(sed -n "/*color4:/s/*color4://p" $xcolors | tr -d [:blank:])
so it's definitely not perfect, but it is an idea that might be expanded upon, and at least i learned something new about sed :)