[Top][All Lists]

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

set +o noglob within completion function disables alias expansion

From: Ian Macdonald
Subject: set +o noglob within completion function disables alias expansion
Date: Wed, 20 Jul 2005 16:13:31 -0700
User-agent: mutt-ng 1.5.9i (Linux)


This is a bit of a corner case, but appears to be a bug.

If one defines a completion function that calls 'set +o noglob' and this
function is then bound to a command, alias expansion is temporarily
disabled when the command is executed.

If the command is subsequently executed again without calling the
completion function, alias expansion occurs as normal.

For example:

address@hidden i386]$ set +o | grep noglob
set +o noglob
address@hidden i386]$ _foo() { local glob=$(set +o|grep noglob); set -f; eval 
"$glob"; }
address@hidden i386]$ complete -F _foo -o filenames ls
address@hidden i386]$ alias ls="echo ALIAS! $1"
address@hidden i386]$ ls ~/foo<Enter>
ALIAS! /home/ianmacd/foo
address@hidden i386]$ ls ~/foo<Tab><Enter>
accesses.db   day12-5    day17-2     divzero        prog4
anagram       day13-1    day17-3     editor.rb      prog5
buzz.db       day13-2    day17-5     executables    runcom.rb
callanalyzer  day13-3    day17-6     fib_test_2.rb  spinner1.rb
cards         day13-4    day18-1     findbox.rb     spinner2.rb
cards.rb      day14-2    day18-4     foo            spinner3.rb
cards2        day14-3.1  day18-5     index.html     spinner4.rb
cards3        day14-3.2  day18-6     inner.rb       spintest.rb
cards4        day14-3.3  day19-1     messagebox.rb  student.rb
complex.rb    day14-4    day19-2.rb  outer.rb       teacher.rb
datagram.rb   day15-2    day20-1     p302           ty_ruby_21_listings
day10-1       day15-4    day20-2     prog1          ty_ruby_21_listings.tgz
day11-2       day15-5    day20-3     prog2
day12-4       day15-6    deck.rb     prog3
address@hidden i386]$ bash --version
GNU bash, version 3.00.16(1)-release (i686-redhat-linux-gnu)
Copyright (C) 2004 Free Software Foundation, Inc.

As you can see, in this second invocation, the alias was not used as it
should have been.

Ian Macdonald               | I sometimes think that God, in creating
address@hidden             | man, somewhat overestimated his ability.   
http://www.caliban.org/     | -- Oscar Wilde 

reply via email to

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