Re: [PATCH] Update bash completions to prevent unbound variable errors.

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

 



* Ted Pavlic [Mon, 12 Jan 2009 16:37:20 -0500]:

>> Because (from a quick look) their completion script never expands a
>> variable which is not known to be set.

> They use $1, $2, etc. In fact, they use $1, $2, and $3 in their _hg,  
> which is their main completion function. Why would those be defined 
> there?

>From http://www.gnu.org/software/bash/manual/bashref.html#Programmable-Completion:

  When the function or command is invoked, the first argument is the name
  of the command whose arguments are being completed, the second argument
  is the word being completed, and the third argument is the word
  preceding the word being completed on the current command line.

> In fact, it's $1, $2, $3, and $4 that are causing the problemw ith the  
> git completions.

They are causing problems in the functions that are called sometimes
with arguments, sometimes without, like __gitdir. If you know that
you'll always be calling a function with $1, you need not use ${1-};
that's what happens in the mercurial completion script AFAICS.

-- 
Adeodato Simó                                     dato at net.com.org.es
Debian Developer                                  adeodato at debian.org
 
The surest way to corrupt a youth is to instruct him to hold in higher
esteem those who think alike than those who think differently.
                -- F. Nietzsche

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux