Hi I am relatively new in shell scripting Below is the code which i developed but for some reason, it keeps giving me error:
/apps/bss/BatchProg/at1/batch/scripts/ksh/TBATLC02.ksh[30]: syntax error at line 41 : `then' unmatched
Code:
#!/usr/bin/ksh
#####################################################################
#
# DESCRIPTION: This jobs checks for following condition -
# if(8 am)
# post "EndOfDay.log" file in the output directory of the
# job
# else if(wave file found)
# post "ExecuteWave.log" file in the output directory of # the job
# else if(camapign contacts file found)
# post "ExecuteCampaignCOntacts.log" file in the output # directory of the job
# else
# keep looping till its 8 am.
#
#####################################################################
SRC_DIR=$1
DEST_DIR=$2
RUN_CHECK=1
#remove any log file from th eoutput directory of the job
rm $DEST_DIR/*
#remove all ctl and eot files
rm $SRC_DIR/*.ctl
rm $SRC_DIR/*.eot
#Keep checking for a file till a wave/ campaign contact file is found #till it is 8 am
while [ $RUN_CHECK -gt 0 ]
do
#check for current time
TIME=`date "+%H%M"`
echo "Time is :"$TIME # For testing
if [ $TIME -gt 0800 ] ; then
echo ''>$DEST_DIR/EndOfDay.log
RUN_CHECK=0
else
#check for wave file
WAVE_FILE=`ls $SRC_DIR/ATHENIAN_IF927_LoadCampaignWave_*.dat`
WAVE_COUNT=${#WAVE_FILE}
if [ WAVE_COUNT -gt 10 ] ; then
echo ''>$DEST_DIR/ExecuteWave.log
RUN_CHECK=0
else
#check for Campaign Contact file
CAMPAIGN_CONTACTS_FILE=`ls $SRC_DIR/ATHENIAN_IF927_LoadCampaignContact_*.dat`
CAMPAIGN_CONTACTS_COUNT=${#CAMPAIGN_CONTACTS_FILE}
if [ CAMPAIGN_CONTACT_COUNT -gt 10 ]; then
echo ''>$DEST_DIR/ExecuteCampaignContacts.log
RUN_CHECK=0
fi
fi
fi
done
Hi all,
i have two simple questions here...
1. i want to know that how to debug the UNIX shell script?
2. is there any way to handling the exception in UNIX shell script like oracle exception handling?
Please provide me those details it would be great help/
Thanks and Regards,
MPS... (3 Replies)
Hi Buddies,
The following is shell scripts which was borrowed from linux box for load average check. it runs good.
(this structure is simple, when load average is too high, it will send alert to user)
#!/usr/bin/ksh
# Set threshold for 1, 5 and 15 minture load avarage
# configured for... (4 Replies)
Hi,
When i run the script ./script.sh sun, this give me no output, it should give me the list of file.
If i run the script without the argument it should send me echo inside usage().
What is the problem?
please help
-Adsi
#!/bin/sh
ROOT_PATH=/net/icebox/vol/local_images/spins... (2 Replies)
Hi,
I have this script, searches and sets variables, then searches and sets more variables from multiple files.
I'd need to debug it a bit.
#!/bin/bash
egrep $1 `find | grep MAGT` >/tmp/resRA-$$
thread=`sed -n '/{0x/ {s/^.*{0x\(*\).*/\1/p;q}' /tmp/resRA-$$`
tag=`sed -n '/Tag=/... (5 Replies)
I know about bash -x, set -x and -v but disappears from Command Line Interface in fraction of second ......
I am looking for a command or script ..complies each line and shows the output after executing each line ....( similar what we have in C )
Thanks in Advance (2 Replies)
I have a shell program which calls a perl program.
I am running the shell program with command;
$ ksh -x <prog_name>
Inside the shell program, I am calling perl with warnings.
I want to capture the entire output as it comes on screen.
The command I tried is:
$ ksh -x... (1 Reply)
How can I debug this script?
I want to know what it is doing or not doing?
#!/bin/bash
#
#
if ; then
# Do the thing you want before suspend here
echo "we are suspending." > /tmp/systemd_suspend_test.txt
elif ; then
# Do the thing you want after resume here
echo "and we are... (21 Replies)
Hello All,
I have got a section of shell script which was working earlier but now it is giving some different results:
MSG=
while true
do
themenu
getchar =
case $answer in
1) export_Config_tables;;
2) export_config_tables_file;;
3)... (1 Reply)
Discussion started by: bghosh
1 Replies
LEARN ABOUT SUNOS
suspend
suspend(1) User Commands suspend(1)NAME
suspend - shell built-in function to halt the current shell
SYNOPSIS
sh
suspend
csh
suspend
ksh
suspend
DESCRIPTION
sh
Stops the execution of the current shell (but not if it is the login shell).
csh
Stop the shell in its tracks, much as if it had been sent a stop signal with ^Z. This is most often used to stop shells started by su.
ksh
Stops the execution of the current shell (but not if it is the login shell).
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWcsu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), kill(1), ksh(1), sh(1), su(1M), attributes(5)SunOS 5.10 15 Apr 1994 suspend(1)