I select the option, the report is being emailed..but its two options emailing one report how can i fix...
here is my
code
!/bin/ksh
WORKDIR=/u1/home/ops
SPOOLFILE=/u1/home/ops/takeondate.csv
LOGO="Users Takeon/Expired"
LIST="graham.goliath@macsteel.co.za,bernard.james@macsteel.co.za,pav.bedasie@macs
teel.co.za"
Displaymenu () {
clear
echo `date`
echo
echo "\t\t\t\t" $LOGO
echo
echo "\tSelect Option:"
echo
echo "\t\t\t [1] Run User Takeon Report "
echo "\t\t\t [2] Run User Expired Report "
echo "\t\t\t [3] Exit Program "
echo
echo "Enter option then ENTER to continue: \c"
}
PressEnter () {
echo Press Enter
read x
}
# A function for each of the menu picks
report_Takeon()
{
echo " Executing Run Takeon Report "
do_takeon
echo " Enter email address then enter to continue: \c"
read EMAIL
echo $EMAIL
do_email
PressEnter
}
report_Expired()
{
echo "Executing Run Expired Report"
do_expired
echo " Enter email address then enter to continue: \c"
read EMAIL
echo $EMAIL
do_email
PressEnter
}
do_takeon()
{
sqlplus -s mac/mac789 <<ENDOFSQL
@${WORKDIR}/takeondate.sql
exit;
ENDOFSQL
}
do_expired()
{
sqlplus -s mac/mac789 << ENDOFSQL
@${WORKDIR}/expirydate.sql
exit;
ENDOFSQL
}
do_email()
{
echo "Emailing report now"
SUBJECT="User Takeon/Expiry report"
#TO=graham.goliath@macsteel.co.za
(
cat $SPOOLFILE
) | /usr/local/bin/mutt -s "$SUBJECT" -a $SPOOLFILE $EMAIL
}
while true
do
Displaymenu
read answer
case $answer in
1) report_Takeon ;;
2) report_Expired ;;
3) break ;;
esac
done
clear
/code
help would be much appreciated
here is my
code
!/bin/ksh
WORKDIR=/u1/home/ops
SPOOLFILE=/u1/home/ops/takeondate.csv
LOGO="Users Takeon/Expired"
LIST="graham.goliath@macsteel.co.za,bernard.james@macsteel.co.za,pav.bedasie@macs
teel.co.za"
Displaymenu () {
clear
echo `date`
echo
echo "\t\t\t\t" $LOGO
echo
echo "\tSelect Option:"
echo
echo "\t\t\t [1] Run User Takeon Report "
echo "\t\t\t [2] Run User Expired Report "
echo "\t\t\t [3] Exit Program "
echo
echo "Enter option then ENTER to continue: \c"
}
PressEnter () {
echo Press Enter
read x
}
# A function for each of the menu picks
report_Takeon()
{
echo " Executing Run Takeon Report "
do_takeon
echo " Enter email address then enter to continue: \c"
read EMAIL
echo $EMAIL
do_email
PressEnter
}
report_Expired()
{
echo "Executing Run Expired Report"
do_expired
echo " Enter email address then enter to continue: \c"
read EMAIL
echo $EMAIL
do_email
PressEnter
}
do_takeon()
{
sqlplus -s mac/mac789 <<ENDOFSQL
@${WORKDIR}/takeondate.sql
exit;
ENDOFSQL
}
do_expired()
{
sqlplus -s mac/mac789 << ENDOFSQL
@${WORKDIR}/expirydate.sql
exit;
ENDOFSQL
}
do_email()
{
echo "Emailing report now"
SUBJECT="User Takeon/Expiry report"
#TO=graham.goliath@macsteel.co.za
(
cat $SPOOLFILE
) | /usr/local/bin/mutt -s "$SUBJECT" -a $SPOOLFILE $EMAIL
}
while true
do
Displaymenu
read answer
case $answer in
1) report_Takeon ;;
2) report_Expired ;;
3) break ;;
esac
done
clear
/code
help would be much appreciated