Smart questions
Smart answers
Smart people
Join Tek-Tips Forums
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Sambo8 (Programmer) (OP)
12 Nov 08 21:14
Hi there,

Please can you take a look at my script, my other functions work fine but funcB gives the error: [55] funcB: not found.

CODE


#!/bin/ksh
CURRENTDAY=$(cat hello)
echo $CURRENTDAY
VAR=$(date +'%a')
echo $VAR
if [ $VAR = $CURRENTDAY ] ; then echo 'Matched'
#################
function funcA  {
CURRENTDAY=$(cat hello)
echo $CURRENTDAY
if find /u01/app/oracle/work/sam/backup/again/errorexists.*.$CURRENTDAY -mtime -1 -print;
        then exit
        else funcX
        fi
}
#################
function funcB {
if find /u01/app/oracle/work/sam/backup/again/errorexists.*
then
echo "OOPs might need to try at lt 1800 to wor"
else
echo "PROBLEMO"
fi
}
#################
function funcX  {
CURRENTDAY=$(cat hello)
echo $CURRENTDAY
if [[ $(cksum /u01/app/oracle/work/sam/backup/again/sam.sh | nawk '{print $2}') -gt 0 ]]
then find /u01/app/oracle/work/sam/backup/again/backup.$CURRENTDAY -mtime -1 -print | xargs grep Error | while read LINE
do
        FILE2=$(echo $LINE | sed 's/.* see //;s/ for details//')
echo $FILE2
[[ -f "$FILE2" ]] && tail -5 $FILE2 || echo "($FILE2 not found)"
echo $FILE2
MOUNT=$(echo $FILE2 | cut -c21-23)
echo $MOUNT
  [ -f errorexists.$MOUNT.$CURRENTDAY ] && touch noproblems.txt || touch errorexists.$MOUNT.$CURRENTDAY
done
else touch noerror.txt
fi
}
##################
else echo 'unMatched'
fi
HOUR=$(date +'%H')
MIN=$(date +'%M')
TIMLIO="$HOUR$MIN"
echo $TIMLIO
if [ $VAR = $CURRENTDAY ] &&  [ $TIMLIO -gt 1800 ] ;
then
    funcA
elif [ $VAR != $CURRENTDAY ]  && [ $TIMLIO -lt 1800 ] ;
then
    funcB
elif [ $VAR = $CURRENTDAY ] &&  [ $TIMLIO -lt 1800 ] ;
then echo "probably exit now and wait till 6pm"
elif [ $VAR != $CURRENTDAY ]  && [ $TIMLIO -gt 1800 ]  ;
then echo "check previous days backup finished"
else echo "problems"
fi

Any help greatly appreciated as I haven't written functions before.

Many thanks,
Sam

 
Sambo8 (Programmer) (OP)
12 Nov 08 22:36
Hi All,

Please ignore my above post, I found the problem was actually the if beginning above the functions with the fi below.  Apologies.

Sam
 

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close