[Top][All Lists]

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

Bash programmable completion: `-W' option to `complete' command

From: Fake address to foil spambots
Subject: Bash programmable completion: `-W' option to `complete' command
Date: Tue, 4 Jan 2005 19:08:52 +0000

Configuration Information [Automatically generated, do not change]:
Machine: i686
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i686' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i686-pc-linux-gnu' 
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/local/bash-3.0/share/locale' 
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H  -I.  -I. -I./include -I./lib   -g -O2
uname output: Linux gilead 2.4.18-686 #1 Sun Apr 14 11:32:47 EST 2002 i686 
Machine Type: i686-pc-linux-gnu

Bash Version: 3.0
Patch Level: 0
Release Status: release


  I'm having problems understanding the behaviour of the `-W' option to
  the `complete' command.  I think there may be a bug in Bash.

  In the section entitled "Programmable Completion", the Bash manpage

    Next, the string specified as the argument to the -W option is
    considered. The string is first split using the characters in the IFS
    special variable as delimiters. Shell quoting is honored. Each word
    is then expanded using brace expansion, tilde expansion, parameter
    and variable expansion, command substitution, arithmetic expansion,
    and pathname expansion, as described above under EXPANSION.

  What I'm finding, however, is that contrary to the extract quoted
  above, pathname expansion is not actually done, even though all the
  other kinds are.  ("Pathname expansion", as I understand it, is just
  another term for globbing.)


  Here's a `complete' command that demonstrates the problem:

    complete -W '`date +%H:%S` *' echo

  If, after issuing this command, I then type "echo", then a space, then
  press Tab twice, the options I get are "17:34" (which is expected)
  and "*" (a literal asterisk, which is not expected).  It appears that
  command substitution is working fine, but pathname expansion isn't.

  (You may be thinking that I executed this command in an empty directory,
  so that there is nothing for the asterisk to expand to, but that's
  not the case.)

reply via email to

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