How do I create BASH alias for:
I type in cdd directory and what that does is cd directory and then ls?
|
feedback
|
This question came from our site for professional and enthusiast programmers.
|
It'd be easier to make a function:
Of course, you can name the function whatever you like. Put it in your .bashrc or .profile or whatever it is on your system. | |||||||||||
feedback
|
|
You want to use a function that you'll put in your
Once you put this in your appropriate file, you can use | |||||
feedback
|
|
Just like the other function examples, but this one will work with directories with spaces, without needing to escape the spaces.
| |||
|
feedback
|
I bet you really want to make directory be an argument, i.e. $1. can't do that with aliases. I hope that helps. | |||
|
feedback
|
ls directoryinstead? – user unknown Jan 13 at 7:20