I find myself repeating a lot of...
mkdir longtitleproject
cd longtitleproject
Is there a way of doing it in one line without repeating the directory name? I'm on bash here.
|
I find myself repeating a lot of...
Is there a way of doing it in one line without repeating the directory name? I'm on bash here. | ||||
|
feedback
|
|
In your
Then run There are also less specialized ways to not have to retype the word from the previous line:
| |||||||||||||||
feedback
|
|
As per What customizations have you done on your shell profile to increase productivity?, this is how I do it:
it means it also works if the directory already exists. | |||||||||||||
feedback
|
|
It would never have occurred to me to script up this behaviour because I enter the following on a near daily basis ...
where bash kindly substitutes In addition, filename completion is your friend in such situations. If your new directory was the only file in the folder a quick double TAB would give you the new directory without re-entering it. Although it's cool that bash allows you to script up such common tasks as the other answers suggest I think it is better to learn the command line editing features that bash has to offer so that when you are working on another machine you are not missing the syntactic sugar that your custom scripts provide. | ||||
|
feedback
|
|
Or you could just create a short variable on-the-fly and use it twice | |||
|
feedback
|
mcdfrom unix.stackexchange.com/questions/6628/… – Mikel Mar 12 '11 at 1:32