Sponsored Content
Top Forums Shell Programming and Scripting Can't figure out else not matching Post 302089338 by peteroc on Monday 18th of September 2006 05:56:33 PM
Old 09-18-2006
Can't figure out else not matching

All,

I appreciate any help you can provide on this. I get an "else unmatched" error with this code and can't figure out why. If I remove the 1st if statement through the 1st else the script runs through fine. Any thoughts?



Code:
#decrypt file
sudo -u gpg /usr/bin/gpg --homedir=/home/gpg/.gnupg --no-tty --decrypt <${UNZIP_FILE}> ${DECRYPT_FILE}
set -x
RC=$?
if (( $RC != 0 )); then
 echo "error in decrypting $PROCESS - file $UNZIP_FILE on cwyeta01. Investigate...." 
 echo "error in decrypting $PROCESS - file $UNZIP_FILE on cwyeta01. Investigate...." | mailx -s "$PROCESS file - error in decryption. Investigate..." $EMAIL_SUPPORT
 exit 1

else
 
 echo "$UNZIP_FILE decrypted successfully to file ${DECRYPT_FILE}. Initiating gzip of $DECRYPT_FILE"
 gzip $DECRYPT_FILE
 #echo "$(date +%T) - Sleeping for 15 minutes"
 #sleep 900
 RC=$?

 if (( $RC != 0 )); then
  echo "Error in gzip command within $PROCESS....investigate." 
  echo "Error in gzip command within $PROCESS....investigate." | mailx -s "$PROCESS - failed within gzip step" $EMAIL_SUPPORT
 
 else
  echo "gzip of $DECRYPT_FILE complete. Initiating FTP for ${DECRYPT_FILE}.gz" 
 fi

# initiate file transfer
 ftp -v -n cpu3 <<-!
 binary	
 quote user $USER
 quote pass $PASS
 quote site RECFM=$RECFM LRECL=$LRECL BLKSIZE=$BLKSIZE UNIT=$UNIT VCOUNT=$VCOUNT RETPD=$RETPD 
 put ${DECRYPT_FILE}.gz $MFFILE 
 bye 
 !
# done with FTP
# ensure FTP transmitted successfully
 grep -q "Data bytes written:" $LOG_NAME
 RC2=$?

 if (( $RC2 == 0 )); then
# capture record count
  ((NUMRECS=`grep "Data bytes written:" ${LOG_NAME} | awk '{print $4}' | tr -d '.' | tr -d '\r'`/$LRECL)) 
#  integer NUMBYTES=`grep "Data bytes written:" ${LOG_NAME} | awk '{print $4}' | tr -d '.' | tr -d '\r'`
#echo "NUMBYTES=$NUMBYTES"}
#(( NUMRECS=$NUMBYTES/$LRECL ))
#echo "NUMRECS=$NUMRECS"
  NUMRECSF=$(echo $NUMRECS | sed -e :a -e 's/^\([^.]*[0-9]\)\([0-9]\{3\}\)/\1,\2/;ta')
  echo "NUMRECSF=$NUMRECSF"
  echo "$Script_Name has completed FTP to mainframe. You can expect $MFFILE with $NUMRECSF records to be on the mainframe."
  echo "$Script_Name has completed FTP to mainframe.. You can expect $MFFILE with $NUMRECSF records to be on the mainframe." | mailx -s "$Script_Name has FTP'd BAMH file to mainframe" $EMAIL_SUPPORT
			
 else
  echo "$Script_Name has failed within the FTP step to the mainframe."
  echo "$Script_Name has failed within the FTP step to the mainframe." | mailx -s "$PROCESS FTP failure" $EMAIL_SUPPORT 
 fi
fi

#FTP log file to midway
ftp -nv midway <<-!
quote user $PUSER
quote pass $PPASS
cd $ODRIVE
pwd
put ${LOG}/$(basename $0 .ksh)"_$(date +%m%d%Y).log $(basename $0 .ksh)"_$(date +%m%d%Y).log
ls
bye
!

# notify users that BAMH log file is on O Drive 
echo "$MESSAGE" | mailx -s "$SUBJECT" $EMAIL_SUPPORT



## end of job cleanup 
mv -f $FILE ${FILE}.pulled 
echo "$FILE has been renamed to ${FILE}.pulled"
rm -f $UNZIP_FILE
echo "$UNZIP_FILE has been deleted from $DIR"
rm -f ${DECRYPT_FILE}.gz
echo "${DECRYPT_FILE}.gz has been deleted from $DIR"

exit 0


Last edited by reborg; 09-18-2006 at 11:02 PM.. Reason: please use code tags, this post was almost unreadable.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

i can not figure this out

I am having problems scripting in UNIX. I am currently attending school and for the first time I am being introduced to scripting. My problem is I am supposed to enhance the spell_check by adding a third optional argument. The third argument is to specify a list of words to be added to the... (1 Reply)
Discussion started by: steph
1 Replies

2. UNIX for Dummies Questions & Answers

figure it out

hi there i am new to this site and this linux and unix stuff so kind of plz help me out hoe to start the stuff.... (1 Reply)
Discussion started by: cool_dude
1 Replies

3. Shell Programming and Scripting

Cant figure out this..

Hi, I need a little help here. I am exporting user info from a PSQL database and everything is working with the exception of this: 10029008:dsAuthMethodStandard\:dsAuthClearText:classword:10029008:2004:10029008:10029008:/home/student/1002/90/08:10029008 It is putting a colon right before the... (1 Reply)
Discussion started by: Stud33
1 Replies

4. IP Networking

How do I figure out the subnet?

Hi, How do I get subnet from this: 10.252.0.138/25 Tnx (2 Replies)
Discussion started by: mehrdad68
2 Replies

5. Solaris

Can't figure out how to automount with subdirectories

I want to be able to mount 3 directories. But two are a subdirectories of the first. /opt/gnu sunpefs02:/export/home/sunpefs02-5/replication/8600finland/gnu /opt/gnu/bin sunpefs02:/export/home/sunpefs02-5/replication/8600finland/gnu/bin-sparc-SunOS /opt/gnu/lib... (3 Replies)
Discussion started by: srhadden
3 Replies

6. UNIX for Dummies Questions & Answers

How to figure out what each IP address is used for?

Hi, I have inherited a server at work that has one IP and two virtual IP's. It is live and I want to figure out what each IP is being used for. I thought of NETSTAT but I cannot figure out how to get it to list what each IP is listening for. ANy advice? (8 Replies)
Discussion started by: mojoman
8 Replies

7. UNIX for Advanced & Expert Users

Can't figure out how this is working

I have two machines, each with a virtual interface, with the following configurations: Machine1: eth2 Link encap:Ethernet HWaddr 00:09:6B:19:E5:05 inet addr:172.16.0.201 Bcast:172.16.0.255 Mask:255.255.255.0 eth2:0 Link encap:Ethernet HWaddr 00:09:6B:19:E5:05 ... (0 Replies)
Discussion started by: druidmatrix
0 Replies

8. UNIX for Dummies Questions & Answers

Can't figure this one out --

I'm putting together a shell script while I'm learning UNIX -- just for myself. It's a little script that simply takes some vendor names and writes them to a file. So far I'm at the stage where the user enters the name of the file and places it in a folder called vendorlists: * ) touch... (5 Replies)
Discussion started by: Straitsfan
5 Replies

9. UNIX for Dummies Questions & Answers

Can't figure out why this repeats

#!/bin/sh while IFS=: read address port; do : ${port:=443} address=$address port=$port cd $f_location number=`grep "$address" thing.txt -A 1 | grep "addresses=" | cut -d'"' -f2` echo "$address,$port,$number,$answer" >>... (9 Replies)
Discussion started by: shade917
9 Replies

10. Shell Programming and Scripting

Help with change significant figure to normal figure command

Hi, Below is my input file: Long list of significant figure 1.757E-4 7.51E-3 5.634E-5 . . . Desired output file: 0.0001757 0.00751 0.00005634 . . . (10 Replies)
Discussion started by: perl_beginner
10 Replies
DELPHFIG(3)						      MBK PHYSICAL FUNCTIONS						       DELPHFIG(3)

NAME
delphfig - delete and free a physical figure ORIGIN
This software belongs to the ALLIANCE CAD SYSTEM developed by the ASIM team at LIP6 laboratory of Universite Pierre et Marie CURIE, in Paris, France. Web : http://asim.lip6.fr/recherche/alliance/ E-mail : alliance-users@asim.lip6.fr SYNOPSYS
#include "mph.h" int delphfig(figname) char *figname; PARAMETER
figname Name of the figure to be deleted DESCRIPTION
delphfig deletes the figure called figname from the list of physical figure in memory. All the lists of elements belonging to the figure are also deleted and freed. RETURN VALUE
delphfig returns 1 if the figure was delete, and 0 if no figure called figname was present in memory. EXAMPLE
#include "mph.h" void delete_na2_y() { if (delphfig("na2_y")) (void)fputs("deleted na2_y successfully", stdout); else (void)fputs("na2_y not present in ram !", stdout); } SEE ALSO
mbk(1), phfig(3), addphfig(3), getphfig(3), loadphfig(3), savephfig(3), flattenphfig(3), rflattenphfig(3). BUG REPORT
This tool is under development at the ASIM department of the LIP6 laboratory. We need your feedback to improve documentation and tools. ASIM
/LIP6 October 1, 1997 DELPHFIG(3)
All times are GMT -4. The time now is 03:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy