Hello, my name is John McPherson. I work for the DOL, in the Uneployment Insurance office, and I am working on an application that uses bash scripts as the controller running the application. I am trying to add a capability to email the output files to the users, which are the states that use the application. The case statement chooses which state to send the email to( or optionally not send an email if state does not want it), is erroring off. I am not sure what the problem is with code. The case statemnet in question is:
## print or display
if test $print_flag
then
if [ $run = FF ]
then
rm -f picktbls
/bfm/devt/comexec/prtmnu $showfl ##select tables >temp.d
act=`cat temp.d`
if [ "$act" = QUIT ]
then ##canceled
bfm_sigon
elif [ "$act" != ALL ]
then
showfl=picktbls
fi
fi
case $OPT1 in
ARKANSAS)
mailx -s "BFM Output" $ARUSER1 < $showfl;;
CONNECTICUT)
mailx -s "BFM Output" $CTUSER1 < $showfl;;
DC2)
mailx -s "BFM Output" $DCUSER3 < $showfl;;
GEORGIA)
mailx -s "BFM Output" $GAUSER1 < $showfl;;
INDIANA)
mailx -s "BFM Output" $INUSER1 $INUSER2 < $showfl;;
KANSAS)
mailx -s "BFM Output" $KSUSER1 $KSUSER2 < $showfl;;
KENTUCKY)
mailx -s "BFM Output" $KYUSER < $showfl;;
LOUISIANA)
mailx -s "BFM Output" $LAUSER1 $LAUSER2 < $showfl;;
MAINE)
mailx -s "BFM Output" $MEUSER1 $MEUSER2 $MEUSER3 < $showfl;;
MARYLAND)
mailx -s "BFM Output" $MDUSER2 < $showfl;;
MINNESOTA)
mailx -s "BFM Output" $MNUSER1 < $showfl;;
NORTH CAROLINA)
mailx -s "BFM Output" $NCUSER7 < $showfl;;
SOUTH CAROLINA)
mailx -s "BFM Output" $SCUSER1 $SCUSER2 < $showfl;;
VERMONT)
mailx -s "BFM Output" $VTUSER1 $VTUSER3 < $showfl;;
WEST VIRGINIA)
mailx -s "BFM Output" $WVUSER1 < $showfl;;
WISCONSIN)
mailx -s "BFM Output" $WIUSER1 < $showfl;;
*)
;;
esac
When I try to run a state's BFM with this code included in the bash script, the script will error off without any error messages. I bring up Putty, enter the state userid and password, and Putty immediately exits. When I comment out the case statement, the state's BFM runs fine. I have checked other case statements in this script that I know work, and they are written the same way this case statement is written. There are other mailx statements in this script that I know work, and they are written as I have these mailx statements. I have Googled the case statement in bash scripts, and the examples I have found match how I have written this case statement. I have tried putting quotes around the case in variable, and that didn't help. I have tried it without a dollar sign in front of the filename variable, and that didn't help. I have verified that the State variable names are exactly how they read into the bash script. Any help with this issue is greatly appreciated.