xargs-constructs an argument list(s) and executes a command

 <  Day Day Up  >  

xargs ”constructs an argument list(s) and executes a command

 xargs [ flags ] [ command [ initialarguments ] ] 

xargs allows you to transfer contents of files into a command line and dynamically build command lines.

Example A.70.
 1   ls   xargs -i -t mv /{} /{} 2   ls  xargs -p -l rm -rf 

EXPLANATION

  1. Moves all files from directory $1 to directory $2 , and echos each mv command just before executing.

  2. Prompts (-p) the user which files are to be removed one at a time and removes each one.

 <  Day Day Up  >  


UNIX Shells by Example
UNIX Shells by Example (4th Edition)
ISBN: 013147572X
EAN: 2147483647
Year: 2004
Pages: 454
Authors: Ellie Quigley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net