[newbie] Very basic bash question
-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- Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Very basic bash question
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi Julian, On Sat, 27 Sep 2003 03:49:26 +0100, julian [EMAIL PROTECTED] wrote about Re: [newbie] Very basic bash question: 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 ..) argh, test worked ... didn't think it would. Anyway: mv ~/foo/bar/file ~/foo -should work from any directory. Clear. If you were in foo you could use: mv bar/file . Many thanks! That`s exactly what I was looking for. - not /bar/file though as this would point to a directory called bar under /- the . stands for the current directory. Sorry: the first `/` was a typo. 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/.. This is also clear, but I don`t think I`ll be needing that much; see below. 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 I use the `move from subdir to dir` in many different places - as they arise - - so indeed I could, but would have to set too many variables to be practical. I'm reading through this basic stuff at the moment. You must be paying better attention than I. Thanks for your answer. Ciao, =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/dQyEwC/zk+cxEdMRAmfMAJ4sfFxwXW7bXqummRVfoKhuC511GwCglWUA ENIDWRhwLeSnQNFIYPXdDzE= =in8G -END PGP SIGNATURE- Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com
Re: [newbie] Very basic bash question
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