6 ms·
I like seeing a listing when I cd. cd() { builtin cd $* && ls; } I cannot recall if that is right (on my phone) but that's the idea in bash at least.
by z8000 17y ago
I like seeing a listing when I cd.
cd() { builtin cd $* && ls; }
I cannot recall if that is right (on my phone) but that's the idea in bash at least.
- jamesbritt 17y agoI just tried it; it works. Very nice; thanks
- imurray 17y agoAlways use "$@" (including the quotes) instead of $* when passing on command-line arguments. If your directory name contains a space, the above function won’t work. Note that putting $* in quotes would be interpreted as one argument, so that wouldn’t work if you specified an option along with a directory name.
- z8000 17y agoYeah that's what I use but couldn't remember it off the top of my head. Thanks.
- avinashv 17y agoHaha this was the first thing I prototyped into my bashrc to incorporate the idea. I used the suggested "$@" myself.