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: Chet Ramey
Subject: Re: need a way to ignore aliases in shell functions
Date: Tue, 23 Nov 2004 11:45:58 -0500
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.7.3) Gecko/20040910

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'.

Chet




reply via email to

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