I have the following function in my .bashrc file on WSL2:
cd() {
builtin cd "$@" && ls
}
I've used this on Cygwin without issue for years, and it works just as well on WSL2, except for one problem: I can't seem to be able to use the built-in cd inside of a new alias in .bashrc.
If cd() was an alias instead of a function, I'd be able to escape it with:
alias new="\cd .. && echo 'This is a new alias'"
or
\cd ..
on the command line. But this override doesn't seem to work with the cd() function like it would with an alias.
Is it possible to override a function in Bash?