bug-bash
[Top][All Lists]
Advanced

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

unalias works weirdly inside an if-then block


From: Gabor Burjan
Subject: unalias works weirdly inside an if-then block
Date: Fri, 12 May 2017 14:33:06 +0200
User-agent: Mutt/1.5.23 (2014-03-12)

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/local/sha$
uname output: Linux hostname 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31
14:07:41 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 0
Release Status: release

Description:
        unalias works weirdly inside an if-then block

Repeat-By:
        By sourcing the code below in an interactive shell

        I can reproduce the bug on vanilla 4.4 version,
        on 4.3.46 (Ubuntu 16.04 default) and
        on 4.2.46 (RHEL 7.1 default)

# Small code snippet to reproduce weird unalias functionality
# Call with "source scriptname" in a fresh *interactive* shell

touch /tmp/a /tmp/b
alias cp='cp -i'

if [[ 1 = 1 ]]; then

    echo -n 'before unalias: '
    alias | grep '^alias cp='
    echo -e "(end of alias output)\n"

    unalias cp
    echo -n 'after unalias: '
    alias | grep '^alias cp='
    echo -e "(end of alias output)\n"

    set -x
    # This one will be interactive, but why?
    cp /tmp/a /tmp/b
fi

# This one won't be interactive
cp /tmp/a /tmp/b
set +x



reply via email to

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