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!