bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Trailing space after completion


From: Udo Willers
Subject: Trailing space after completion
Date: Wed, 20 Jun 2001 16:26:56 +0200

Hi anybody,
there should be a possibility to suppress the trailing space after a
completion. Maybe via the
-o option of compgen.  I would like to do a programmed completion for
the export command
like the following code:

_export()
        {
        COMPREPLY=()
        local cur prev
        cur=${COMP_WORDS[COMP_CWORD]}
        prev=${COMP_WORDS[COMP_CWORD-1]}
        if [ $COMP_CWORD -eq 1 ]; then
            if [[ $cur == DISPLAY\=* ]]; then
                COMPREPLY=( $(grep -sv '^#' /etc/hosts | awk '{print
$2}' | grep ^${cur#DISPLAY=} | awk '{print $1 ":0.0"}' ORS=" " ) )
                return 0
            fi
            COMPREPLY=( $(compgen -v -o filenames -S '=' | grep ^$cur) )
        fi
        }
        complete -F _export export

This works fine except for the space.

Best regards,

Udo Willers
 
----------------------------------------------------------------------
Udo Willers                                     Tel.: +49 4421 985 544
Labor fuer VLSI-Design                          Fax.: +49 4421 985 304
Fachhochschule Oldenburg/Ostfriesland/Wilhelmshaven
Friedrich-Paffrath-Str. 101    http://www.fh-wilhelmshaven.de/~willers
D-26389 Wilhelmshaven          EMAIL: willers@fbe.fh-wilhelmshaven.de
----------------------------------------------------------------------
WINDOWS(TM) - from the people who brought you EDLIN!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]