complete_nick: be compatible with default ii out format - sob - simple output bar
 (HTM) git clone git://git.codemadness.org/sob
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 215516a8bfac89528bcdee472b89d18546504515
 (DIR) parent 86488a280037b6fe03a9311ca34ad9ccff3a1814
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Fri, 31 Oct 2014 13:37:45 +0000
       
       complete_nick: be compatible with default ii out format
       
       Diffstat:
         M scripts/complete_nick               |      28 ++++++++++++++--------------
       
       1 file changed, 14 insertions(+), 14 deletions(-)
       ---
 (DIR) diff --git a/scripts/complete_nick b/scripts/complete_nick
       @@ -1,31 +1,31 @@
        #!/bin/sh
        
       -file="$OUTFILE"
       -test -f "$file" || exit 1
       +file="${OUTFILE}"
       +test -f "${file}" || exit 1
        
        grepword() {
                if test x"$1" = x""; then
       -                grep -oE '^[0-9\-]* (<[^>]*)' "$file" | sed 's@^[0-9\-]* <@@g'
       +                grep -oE '^[0-9\: \-]*(<[^>]*)' "${file}" | sed 's@^[0-9\: \-]*<@@g'
                else
       -                grep -oE '^[0-9\-]* (<[^>]*)' "$file" | sed 's@^[0-9\-]* <@@g' | grep -E "^$1"
       +                grep -oE '^[0-9\: \-]*(<[^>]*)' "${file}" | sed 's@^[0-9\: \-]*<@@g' | grep -E "^$1"
                fi
        }
        
       -word="$SOBWRITE"
       +word="${SOBWRITE}"
        
       -#if test x"$DISPLAY" = x""; then
       -#        line=$(grepword "$word" | sort | uniq | slmenu -l 20)
       +#if test x"${DISPLAY}" = x""; then
       +#        line=$(grepword "${word}" | sort | uniq | slmenu -l 20)
        #else
       -#        line=$(grepword "$word" | sort | uniq | dmenu -l 20)
       +#        line=$(grepword "${word}" | sort | uniq | dmenu -l 20)
        #fi
        
       -matches=$(grepword "$word" | sort | uniq | wc -l)
       -if test x"$matches" = x"1"; then
       -        line=$(grepword "$word" | tail -n 1)
       +matches=$(grepword "${word}" | sort | uniq | wc -l)
       +if test x"${matches}" = x"1"; then
       +        line=$(grepword "${word}" | tail -n 1)
        else
       -        line=$(grepword "$word" | sort | uniq | dmenu -l 20)
       +        line=$(grepword "${word}" | sort | uniq | dmenu -l 20)
        fi
        
       -if test x"$line" != x""; then
       -        printf '%s' "$line"
       +if test x"${line}" != x""; then
       +        printf '%s' "${line}"
        fi