bug-bash
[Top][All Lists]
Advanced

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

Re: leading equal-sign stripped when doing programmable completion


From: Chet Ramey
Subject: Re: leading equal-sign stripped when doing programmable completion
Date: Tue, 4 Jan 2005 16:41:10 -0500

> Machine Type: i686-pc-linux-gnu
> 
> Bash Version: 3.0
> Patch Level: 0
> Release Status: release
> 
> Description:
> 
>       When I define a function to perform completion, Bash appears
>       to strip leading equals-signs from command arguments before
>       passing them to my function.
> 
> Repeat-By:
> 
>       First of all, I give the following `complete' command:
> 
>               complete -F print_args echo
> 
>       Then I define the following function:
>       
>               print_args() {
>                       echo
>                       echo "Argument 1: $1"
>                       echo "Argument 2: $2"
>                       echo "Argument 3: $3"
>               }
> 
>       Now, I type the following (so the cursor is directly
>       after the `b') and then press Tab:
> 
>               echo =a =b
>       
>       `print_args' is invoked and prints the following:
>               
>               Argument 1: echo
>               Argument 2: b
>               Argument 3: =a
> 
>       Bash appears to have stripped the leading equals-sign off "=a" before
>       passing it to `print_args'.  This looks like a definite bug.

It's not.

The `=' is one of the completion `word-break' characters -- characters that
separate words to be completed.  The current set of such characters appears
in the value of $COMP_WORDBREAKS.  If you want to remove `=' from that set,
something like

        COMP_WORDBREAKS=${COMP_WORDBREAKS//=/}

should suffice.

(And try to refrain from doing things like sending mail as address@hidden'.
All that does is make it difficult to reply.)

Chet

-- 
``The lyf so short, the craft so long to lerne.'' - Chaucer
( ``Discere est Dolere'' -- chet )
                                                Live...Laugh...Love
Chet Ramey, ITS, CWRU    address@hidden    http://tiswww.tis.cwru.edu/~chet/




reply via email to

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