SPUG:~damian/bin scripts. [Offtopic]

Daniel James djames at serv.net
Wed Jan 22 01:25:53 CST 2003


On Tue, Jan 21, 2003 at 11:05:35PM -0800, Adam Monsen wrote:
> # .bashrc
> alias cd='cd $*; ls'
> 
> Unfortunately, bash doesn't execute the 'cd', my guess is to avoid 
> infinite recursion.

Seems to me it's executing it, but it seems to be executing in a child
shell so it returns you back to the parent's directory.

This works though
# .bashrc
cwd(){
	cd $*
	ls
}

You have to get used to typing cwd though; if you name your function "cd"
then you will get an infinite loop--someone here may know how to get
around your alias problem though.



More information about the spug-list mailing list