shell script problem.

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
chooi
Participant
Posts: 19
Joined: Wed Jan 26, 2005 8:33 pm

shell script problem.

Post 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.
dsxuserrio
Participant
Posts: 82
Joined: Thu Dec 02, 2004 10:27 pm
Location: INDIA

Post 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
dsxuserrio

Kannan.N
Bangalore,INDIA
Post Reply