Hi When you do a copy or move or some such operation in bash terminal., for ex.,
cp ../../folder/abc.dat ../new_folder/folder/
And now I'd like to do
cd ../new_folder/folder/
But., copy-paste is not interesting always. Probably one of the way to do this is by,
p=../new_folder/folder/ [ or p=$(pwd) or whatever]
cp ../../folder/abc.dat $p
cd $pIn other words, if I do cp source destination, how to do a cd destination by means of some
command line tricks...?Is there any other kind of trick which is more useful and easy than the above method.
I hope someone can come up with a good answer...
With thanks and regards
arun
cd ../new_folder/folder/cp ../../folder/abc.dat . # space and a period at the end
Fine.., but let me re-frame the question. When I do,cp source destination
,is it possible to re-use either 'source' or 'destination' as a variable with a later command? I mean, once the above command is done, say the 'source' should be assigned to 'var1', 'destination' to 'var2'. Or do we need to write a script for the same?
with thanks
arun
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |