On Friday 26 Sep 2003 4:10 pm, Dick Gevers wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,
>
> I studied the bash documentation reasonably thoroughly, including man mv
> and info mv, but I haven`t found the answer to this; so I am hoping for a
> simple answer here:
>
> Often I am in /home/dvg/foo and want to move files from /home/dvg/foo/bar
> to ~/foo. I can`t find a command shortcut to do this. Until now I have had
> to work around by:
> cd bar
> mv file* ..
> s (=alias for cd ..)
>
> Naturally I could have done:
> mv /bar/file* ~/foo, but sometimes my current prompt is several levels down
> and I prefer to keep it short and simple. I`m sure there is an easier way.
>
> TIA for your answer.
>
> Regards,
> =Dick Gevers=
>
>
> .---->
> Mandrake visibility? See headers...
> <----.
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.3 (GNU/Linux)
> Comment: Encryption is an envelope - the contents are private.
>
> iD8DBQE/dFb8wC/zk+cxEdMRAum9AJ92+9vZGP/8NSxZki68DxnZm83Q6QCgoIif
> aGogvymnC5ixKS4qwm3Cmk8=
> =nRjw
> -----END PGP SIGNATURE-----

argh, test worked ... didn't think it would.

Anyway:
mv ~/foo/bar/file ~/foo
-should work from any directory. 

If you were in foo you could use:
mv bar/file .
- not /bar/file though as this would point to a directory called bar under /
- the . stands for the current directory.

If you are moving files all the time you could do:
export foobar=~/foo/bar
- this sets the variable foobar to hold the path to save having to type it.
from then on you could use:
mv $foobar/file $foobar/..

If you wanted to you could edit ~/.bash_profile so that the variable foobar is 
set when you start bash. add the following:
foobar=~/foo/bar
export foobar

This wouldn't be much use unless this file moving of yours is always from bar 
to foo.
I'm reading through this basic stuff at the moment. I didn't understand where 
~/ was.

Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to