Page 1 of 1

shell script problem.

Posted: Sat Mar 26, 2005 2:06 am
by chooi
Hi all,
I am planned to delete a sequential file after run a job.But my shell script have problem.The problem is like this:
I pass the sequential file name as parameter to shell script. the shell script will read a text file which the text file name is the sequential file name and the other files' path which also will be deleted.
But the problem is : It will failed in case the text file only contain 1 line of input .It need 2nd line even it is blank. The script is write like this:

exec < $textfilename
while read LINE;
do
<capture the file name and path and delete the file>
done

Any ideas?how to set detect EOF? any web site recommend to me?I know here is forum for DataStage .But please help me on this. Thanks.

Posted: Sat Mar 26, 2005 3:03 pm
by dsxuserrio
Please try this

Code: Select all

#!/bin/ksh
FILENAMELIST=$1

PROG=`basename $0`

while read FILENAME discard
do
echo "Deleting $FILENAME"
rm -f $FILENAME
done < $FILENAMELIST
~
Thanks