![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Checking if a file exists | gugs | Shell Programming and Scripting | 4 | 07-23-2008 12:42 PM |
| Need to write a script in UNIX to find a file if another file exists | mmdawg | Shell Programming and Scripting | 1 | 05-04-2008 11:40 PM |
| Check File Exists and compare to previous day file script | rbknisely | Shell Programming and Scripting | 3 | 02-07-2008 11:53 AM |
| File exists with Permissions | Jose Miguel | Shell Programming and Scripting | 2 | 04-16-2007 01:07 PM |
| File exists and is empty | dstinsman | UNIX for Dummies Questions & Answers | 5 | 02-09-2006 11:05 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
File exists routine
Hello experts,
I need some help here.. I've written the following routine to check for existence of files. The routine does the following. It will look for a compressed ( .Z ) file and if it exists, then it will uncompress it, if it is already uncompressed, then it will just diplay a message saying "Already compressed" or else it will display the message saying "File doesn't exist". But I am sort of doing into infinite loop here.. Output below. Please can you help ? Your help is really appreciated. uncompress () { PARFILE=/gbwaaposoa2q4/ora01/app/oracle/orajobs/metadata cat ${PARFILE} | while read line do TABNAME=`echo $line | awk '{print $1}'` PART=`echo $line | awk '{print $2}'` REF=`echo $line | awk '{print $3}'` echo "Table name is ${TABNAME}" echo "partition name is ${PART}" echo "Business ref is ${REF}" DMPFILE=${TABNAME}_PRT_${PART}.dmp echo "exp dir is $EXPDIR " cd ${EXPDIR} if [ -f ${EXPDIR}/${DMPFILE}.Z ]; then uncompress ${DMPFILE}.Z elif [ -f ${EXPDIR}/${DMPFILE}]; then echoLog "Dump file ${DMPFILE} exists on disk. Already uncompressed. " else echoLog "Dump file ${DMPFILE} does not exist. " fi done } My PARFILE is as below QSFQ1> more metadata SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' SOACOE_AUDIT 01122008 'S3DSenderESCP_v1.2.0:MsgId=1155460108' SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=163823082' SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=165751555' SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=200324' SOACOE_AUDIT 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=608834' SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=163823082' SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:SalesEntity_ID=165751555' SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=200324' SOACOE_LOGGER_SUMMARY 24112008 'CoPeRSender_v1.2.0:Organization_CoPeR_ID=608834' I get the following output when i run this.. ./restore_data.ksh[188]: [: missing ] 08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist. Table name is SOACOE_AUDIT partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp Table name is SOACOE_LOGGER_SUMMARY partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp ./restore_data.ksh[188]: [: missing ] 08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist. Table name is SOACOE_AUDIT partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp Table name is SOACOE_LOGGER_SUMMARY partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp ./restore_data.ksh[188]: [: missing ] 08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist. Table name is SOACOE_AUDIT partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp Table name is SOACOE_LOGGER_SUMMARY partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp ./restore_data.ksh[188]: [: missing ] 08:40:04 Dump file SOACOE_LOGGER_SUMMARY_PRT_24112008.dmp does not exist. Table name is SOACOE_AUDIT partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp Table name is SOACOE_LOGGER_SUMMARY partition name is 24112008 Business ref is 'CoPeRSender_v1.2.0:SalesEntity_ID=160598319' exp dir is /tmp Thanks for your help in advance. G |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|