Enhanced font detection for terminology

As 'grep -B' is a GNU extension, a more portable solution is preferable. The most direct and simple solution would be using 'awk':

    awk '/^font.name$/{print a}{a=$0}'

But a sed solution could also be applied:

    sed -n '/^font\.name$/{g;1!p;};h'
This commit is contained in:
Vincent Aranega 2016-06-16 15:39:30 +02:00
parent 90c46651d6
commit f5a9393d4b
1 changed files with 1 additions and 1 deletions

View File

@ -1816,7 +1816,7 @@ gettermfont () {
;; ;;
"terminology") "terminology")
termfont="$(strings ${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg | grep -B1 font.name | head -1)" termfont="$(strings ${XDG_CONFIG_HOME}/terminology/config/standard/base.cfg | awk '/^font.name$/{print a}{a=$0}')"
termfont="${termfont/.pcf}" termfont="${termfont/.pcf}"
termfont="${termfont/:*}" termfont="${termfont/:*}"
;; ;;