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 c
On Sun, 4 Dec 2005, XIAO Gang wrote:
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 followin
XIAO Gang wrote:
> #! /bin/bash
>
> if true; then
> alias myls=ls
> alias -p
> myls
> fi
>
> myls
In a script it is considered better form to use shell functions than
to use aliases. Aliases are an old csh feature. Functions generally
provide that functionality in a better fashion.
#!/bin/b
XIAO Gang wrote:
>
> 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 followi