Re: Alias and if

2005-12-04 Thread Chet Ramey
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

Re: Alias and if

2005-12-04 Thread Bob Proulx
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

Re: Alias and if

2005-12-04 Thread Chris F.A. Johnson
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

Alias and if

2005-12-04 Thread XIAO Gang
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