Linux_cat
08-25-2004, 08:02 AM
Right, i am currently in the process of writing a script that will look into a directory and pass every single text file located in the directory through a DB2 scritping command to automate my testing.
Problem is i dont know how to get the script to
a) read all files in a directory
b) for each file run the DB2 command, one after another
c) not duplicate or use a file more than once.
can someone shed some light on this matter, i am still very much learning bash scripting so any help would be greatly appreciated especially with syntax's.
I am currently doing the first part of the script where i test the directory this is as far as i have got:
#!/bin/bash
echo -e "This script will automate the testing for you, please enter the name of the directory that holds the sql text files:\
c"
read directory
if [ -d directory ]
then
cd $directory; ls -1 *.sql
while read filename
do
echo $filename
done
I thank everyone in advance for any help they can offer.
Problem is i dont know how to get the script to
a) read all files in a directory
b) for each file run the DB2 command, one after another
c) not duplicate or use a file more than once.
can someone shed some light on this matter, i am still very much learning bash scripting so any help would be greatly appreciated especially with syntax's.
I am currently doing the first part of the script where i test the directory this is as far as i have got:
#!/bin/bash
echo -e "This script will automate the testing for you, please enter the name of the directory that holds the sql text files:\
c"
read directory
if [ -d directory ]
then
cd $directory; ls -1 *.sql
while read filename
do
echo $filename
done
I thank everyone in advance for any help they can offer.