Posted on 1st December 20093 Responses
How Can You Read Variables Into The Mv File Program In Unix?

Plz provide suitable commands.

Comments
comment by Blue chip hosting
Posted on December 1, 2009 at 1:29 am

I think i understand your question.. you’re asking how to pass shell variables into the mv command correct..
heres an example… lets say you lost a file and need to find it and automaticly move it to /home/bluechip/backup directory.. heres how with a variable pass
for ea in `find / -name some.file`; do mv $ea /home/bluechip/backup; done
run that from command line… and you will find your file in /home/bluebill/backup/some.file .. hope it helps.. its good to try with echo before a mv though!
please note you are invoking `some command` with ` ticks not ‘ … just pay close attention to it.. you invoke `command` into ea variable..
then you use $ea to recall it later… for ea doesnt need $ to be set..
Hope it helps!
Blue chip hosting staff,http://techblog.bluechiphosting.com

comment by Nick F
Posted on December 1, 2009 at 1:29 am

what do you mean, you just use command line arguments to specify source, destination like:
mv source destination
do man mv for more info

comment by deque
Posted on December 1, 2009 at 1:29 am

You don’t, you use flags.
If you’re wondering how to move one file into another file type this into the command line:
mv file1 file2
this moves file1 into file2. If you were to do an “ls file2″ you’d see that file1 is among the files in file2.
use the man page for mv (type: man mv)

Leave a Response
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Improve the web with Nofollow Reciprocity.