[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) |
Hi,
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:
[ianmacd@sagan i386]$ set +o | grep noglob
set +o noglob
[ianmacd@sagan i386]$ _foo() { local glob=$(set +o|grep noglob); set -f; eval
"$glob"; }
[ianmacd@sagan i386]$ complete -F _foo -o filenames ls
[ianmacd@sagan i386]$ alias ls="echo ALIAS! $1"
[ianmacd@sagan i386]$ ls ~/foo<Enter>
ALIAS! /home/ianmacd/foo
[ianmacd@sagan 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
[ianmacd@sagan 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
--
Ian Macdonald | I sometimes think that God, in creating
ian@caliban.org | man, somewhat overestimated his ability.
http://www.caliban.org/ | -- Oscar Wilde
|
|
- set +o noglob within completion function disables alias expansion,
Ian Macdonald <=