Artificial intelligent assistant

cp or mv files to same directory they are already in when I am in another? If I am in `~/blob` and I have a file in `~/blob/a_long_directory_name/c/x.x` I can type mv blob/a_long_directory_name/c/x.x blob/a_long_directory_name/even_more/y.y Is there any shortcut whereby I can type something shorter that uses the directory path in the first param (not my current directory though), e.g. mv blob/a_long_directory_name/c/x.x $same_dir/y.y where something like `$same_dir` would point to the dir of param 1

To minimize the amount of typing, it's probably easiest to do it in two steps. CD to the directory, then move.

If you only have one command, you can use a subshell:


$ (cd blob/a_long_directory_name/c/ && mv x.x y.y )


That means the `cd` will only take effect in the subshell, the `mv` will only happen if the `cd` succeeds, and the working directory of your current shell won't change.

If you have more than one command, use the directory stack.


$ pushd blob/a_long_directory_name/c/
$ mv x.x y.y
$ mv z.z q.q
$ popd

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy e5b2ee4b7a80e24dfa28015f95dc9d94