Hi I have a bourne shell script that copies a file to another server or to a shared directory is there a way to do some kind of error handling if the file is unsuccessfully when copying over? Any help or links would be great.
#!/bin/sh
EDIOLD_DIR=/usr/local/cyclone/data/14001695568GT/ediold GIS_DIR=/usr/local/GIS4/AAFES/CYCLONE_D
LOG_DIR=/usr/local/cyclone/logs INBOUNDFILE=$1
FILENAME=`basename $INBOUNDFILE`
DATETIME=`date +%m/%d/%y" "%H:%M:%S` ID=14001695568GT
SHORTFN=`echo $FILENAME |sed -e 's/\(.*\)'$ID'\(.*\)/\1\2/'`
echo $SHORTFN
#cp $INBOUNDFILE $EDIOLD_DIR/tmp/$SHORTFN
cp $INBOUNDFILE $GIS_DIR/$SHORTFN
chmod 777 $GIS_DIR/$SHORTFN
# Move Inbound EDI file to EDIOLD directory
mv $INBOUNDFILE $EDIOLD_DIR/$FILENAME
#!/bin/sh
EDIOLD_DIR=/usr/local/cyclone/data/14001695568GT/ediold GIS_DIR=/usr/local/GIS4/AAFES/CYCLONE_D
LOG_DIR=/usr/local/cyclone/logs INBOUNDFILE=$1
FILENAME=`basename $INBOUNDFILE`
DATETIME=`date +%m/%d/%y" "%H:%M:%S` ID=14001695568GT
SHORTFN=`echo $FILENAME |sed -e 's/\(.*\)'$ID'\(.*\)/\1\2/'`
echo $SHORTFN
#cp $INBOUNDFILE $EDIOLD_DIR/tmp/$SHORTFN
cp $INBOUNDFILE $GIS_DIR/$SHORTFN
chmod 777 $GIS_DIR/$SHORTFN
# Move Inbound EDI file to EDIOLD directory
mv $INBOUNDFILE $EDIOLD_DIR/$FILENAME