The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 10-11-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,910
If that command accepts multiple arguments it would be more efficient when run like this:

Code:
vmchange -m N0001 N0002 ... N000n
So, if your shell supports brace expansion (ksh93, zsh, bash >=3.0)
and process substitution:

Code:
xargs vmchange -m < <(printf "N%04d\n" {1..100})
If the command does not accept multiple arguments:

Code:
printf "vmchange -m N%04d\n" {1..100}|sh
Or just use a more powerful tool:

Code:
perl -le'system sprintf "vmchange -m N%04d\n",$_ for 1..100'