Well I got it working pretty much:
Code:
#!/bin/ksh
export REMICDATA='notfound'
export serials='NULL'
while read line
do
if [ $? -ne 0 ] #Break if EOF
then
break
fi
export testremic=`echo $line | tr -d " \t"i`
if [ $testremic == "DATA=REMIC" ] #Break if you hit DATA = REMIC
then
REMICDATA="found"
fi
if [ $REMICDATA == "found" ]
then
if [ $testremic != "DATA=REMIC" ]
then
if [ $serials == "NULL" ]
then
export serials=`echo $line | cut -f3-3 -d" "`
else
export serials=$serials,`echo $line | cut -f3-3 -d" "`
fi
fi
else
export exportstring=`echo $line | tr -d " \t"i`
export $exportstring
fi
done < $1
echo $0: Executing command: other.cmd "${JOBNUMBER}" "${SERVER}" "${DATABASE}" "${USERID}" "${PASSWORD}" "${ENVIR}" "${REPORTNAME}" "${REPORTTITLE}" "${PAYDATE}" ${serials}
But it goes in an infinite loop if I dont pass the file name, how can I check to make sure a file is there and I can open it?
And this thing is verrry slow. Im guessing I shouldnt be doing that loop or something. If someone could please point me towards the correct way on doing this I would greatly appreciate it. Thanks