bug-bash
[Top][All Lists]
Advanced

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

Re: need a way to ignore aliases in shell functions


From: Ian Macdonald
Subject: Re: need a way to ignore aliases in shell functions
Date: Tue, 23 Nov 2004 12:52:31 -0800
User-agent: Mutt/1.5.6i

On Tue 23 Nov 2004 at 11:45:58 -0500, you wrote:

> Ian Macdonald wrote:
> 
> >When writing programmable completion functions, it would be very handy
> >to be able to instruct bash to ignore aliases inside functions. It's
> >often necessary to call things like sed, awk and grep inside completion
> >functions and, if the user has aliased these commands, all manner of
> >unexpected subtle errors can occur.
> 
> There's nothing preventing you from adding this protection.  Aliases
> are expanded when a shell function is read and parsed, not when it is
> executed.  One simply needs to bracket the programmable completion
> function definitions with `shopt -u expand_aliases' and a corresponding
> `shopt -s expand_aliases'.

Indeed, something like 'expand_aliases' is exactly what I was looking
for, but I had skipped over it when reading the man page.

Thanks,

Ian
-- 
Ian Macdonald               | It's easier to fight for one's principles
System Administrator        | than to live up to them. 
ian@caliban.org             | 
http://www.caliban.org      | 
                            | 




reply via email to

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