[Centos] help with xargs and mv

Troy Engel tengel at fluid.com
Tue Feb 8 22:56:30 UTC 2005


James B. Byrne wrote:
> 
> cat file4 | 	xargs mv /var/spool/mqueue/'{}' \
> 			/var/spool/mqueue/offline 

To provide an alternate way (thanks Dag, learned a new xargs switch :) ) 
I would instintively write this bash command as:

   while read filename && [[ "$filename" != end ]]
   do
     mv -f "/var/spool/mqueue/$filename" /var/spool/mqueue/offline/
   done < "/path/to/file4"

hth,
-te

-- 
Troy Engel | Systems Engineer
Fluid, Inc | http://www.fluid.com



More information about the CentOS mailing list