This is a situation I often find myself in:
mkdir /Some/really/long/path/to/a/directory/
cd /Some/really/long/path/to/a/directory/
I know that ideally you would cd /Some/...etc.../a/
and then mkdir directory
, but I've often performed mkdir
first and then had to cd
to the end of the same lengthy file path I just created.
Short of doing...
var="/Some/...etc.../a/"
mkdir $var/directory; cd $var
...which is even worse, is there some way to reuse the parameter passed to the previous command? I'm aware of course of tab completion, but in a series of nested directories with similar names this doesn't always help that much. Ideally, I'm hoping for a shortcut like $#
or $@
.
Failing this, the next best time-saving solution would be equally appreciated!