[Top][All Lists]

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

unusual `unalias' behavior in shell function

From: tromey
Subject: unusual `unalias' behavior in shell function
Date: Wed, 1 Aug 2001 22:25:29 -0600

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: Linux
Compiler: gcc
-O2 -m486 -fno-strength-reduce
uname output: Linux creche 2.2.16 #2 Mon Aug 28 10:13:00 MDT 2000 i686 unknown

Bash Version: 1.14
Patch Level: 7

A person on a Linux user's group mailing list I'm on pointed out
some unusual behavior of `unalias' inside a shell function.

Note that I have duplicated this bug using bash 2.04 on Red Hat Linux

Here is a bash session showing the problem:

    creche. touch foo bar
    creche. alias cp='cp -i'
    creche. doit ()
    > {
    > type cp
    > unalias cp
    > type cp
    > cp foo bar
    > }
    creche. doit
    cp is aliased to `cp -i'
    cp is hashed (/bin/cp)
    cp: overwrite `bar'? y

I expected the `unalias' in the function to affect the following `cp'
invocation.  Yet, seemingly, it does not.  A similar sequence sans
function works as I expect:

    creche. touch foo bar
    creche. alias cp='cp -i'
    creche. cp foo bar
    cp: overwrite `bar'? y
    creche. unalias cp
    creche. cp foo bar

        [Describe the sequence of events that causes the problem
        to occur.]

        [Description of how to fix the problem.  If you don't know a
        fix for the problem, don't include this section.]

reply via email to

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