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 -->
  #3 (permalink)  
Old 11-20-2007
Franklin52 Franklin52 is offline Forum Staff  
Moderator
  
 

Join Date: Feb 2007
Posts: 4,342

Code:
#!/bin/sh

echo $1 |
awk 'BEGIN {
n="abcdefghijklmnopqrstuvwxyz"
printf("myprog")}
{ for (i=1;i<=$0;i++) {
  printf(" -%s %02d/%02d.ext", substr(n,i,1), i, i)
  op=op substr(n,i,1)"+"
  }
  op=substr(op,1,length(op)-1)
  printf(" -operation \"%s\"\n",op)
}'

Usage: "scriptname 5" instead of "scriptname 01 ... 05".

One value suffice.

Regards