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 03-18-2008
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Wink An attempt at some code

I do not think you need the TableCount variable, and perhaps a few other things inside your original code. Hopefully, this will put you on your way...


Code:
> cat script.sh
#! /bin/bash

NumberOfTables="$#"
let TableCount=1

while [ ${NumberOfTables} -gt 0 ]
do

 TableName='$'$TableCount
 
# db2 "runstats on table ${TableName} and indexes all"
# echo ${TableName}
 echo $1
 shift 

 let  TableCount=TableCount+1
 let  NumberOfTables=NumberOfTables-1

done
exit 0

Quote:
> script.sh table1 table2 table3
table1
table2
table3