How Can You Read Variables Into The Mv File Program In Unix?
Plz provide suitable commands.
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
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)
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