bug-bash
[Top][All Lists]
Advanced

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

Alias and if


From: XIAO Gang
Subject: Alias and if
Date: Sun, 04 Dec 2005 12:20:31 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20050331)


Version: GNU bash, version 3.00.16(1)-release (i386-pc-linux-gnu)

Hardware: AMD Athlon 3GHz+, 1G RAM.

OS: Linux (Knoppix-3.9).

Compilation: Distributed by Debian.

Description: An alias defined within an "if" branch has no effect.

Recipe: in the following script, the alias "mycp" is unknown command. The problem disappears when
the line "alias myls=ls" is moved before the "if" line.

Note that the definition is however recorgnized by "alias -p".

The same phenomenon is reported on slightly different recent builds of Linux.

####################################

#! /bin/bash

if true; then
alias myls=ls
alias -p
myls
fi

myls

####################################

--

XIAO Gang (~{P$8U~})                      http://wims.unice.fr/xiao/






reply via email to

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