I didn't make this script, but I am attempting to add to it. I have simplified it for purposes of posting here.
Basically, we use this very old linux-based (Cobol) accounting software in one of our branches. In the past, someone made a menu to access the different versions of the program which were used in different years. All the previous options work fine.
I have attempted to add a new "Option1" for the latest version of this old program.
When accessing the program through the menu, it launches and starts fine, and the user can enter the program, but when accessing certain parts of the interface, it seems to "crash" back to the menu. Honestly, I'm not sure if it is crashing or simply "losing focus" (this is more a Windows terminology since this is all CLI).
Alternatively, when the user access the same program (in this example APROGRAMFILE2) "directly" via a .bash_profile script, the program behaves normally as expected.
It may also help to know that the user is accessing the program via Putty using an SSH setting with the "Terminal-type string" set to "linux" instead of the default "xterm". The server is running CentOS 5.5.
Any ideas what could be causing this behavior with this relatively simple script? Is this some subtle difference between bash and shell?
I have pasted the sh script (which works to launch and run the program, but "crashes" consistently when accessing certain features) and the .bash_profile (which works fine in all cases) below:
menu.sh
.bash_profile
Basically, we use this very old linux-based (Cobol) accounting software in one of our branches. In the past, someone made a menu to access the different versions of the program which were used in different years. All the previous options work fine.
I have attempted to add a new "Option1" for the latest version of this old program.
When accessing the program through the menu, it launches and starts fine, and the user can enter the program, but when accessing certain parts of the interface, it seems to "crash" back to the menu. Honestly, I'm not sure if it is crashing or simply "losing focus" (this is more a Windows terminology since this is all CLI).
Alternatively, when the user access the same program (in this example APROGRAMFILE2) "directly" via a .bash_profile script, the program behaves normally as expected.
It may also help to know that the user is accessing the program via Putty using an SSH setting with the "Terminal-type string" set to "linux" instead of the default "xterm". The server is running CentOS 5.5.
Any ideas what could be causing this behavior with this relatively simple script? Is this some subtle difference between bash and shell?
I have pasted the sh script (which works to launch and run the program, but "crashes" consistently when accessing certain features) and the .bash_profile (which works fine in all cases) below:
menu.sh
Code:
clear;
menu()
{
clear;
echo " 1. Option 1"
echo " 2. Option 2"
echo " Exit: (X/x)"
echo -e "Enter your option................: \c";read option
}
option1()
#note I have tried 'sh APROGRAMFILE2´and 'sh ./APROGRAMFILE2' here just to be thorough
{
cd /some/directory2
sh APROGRAMFILE2
menu;
}
option2()
{
cd /some/directory1
sh APROGRAMFILE1
menu;
}
menu
while :
do
case $option in
1) option1;;
2) option2;;
x) exit;;
X) exit;;
*) menu;;
esac
done
clear
echo "Finish"
clear;exit
.bash_profile
Code:
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
PATH=$PATH:$HOME/bin
export PATH
cd /some/directory2
./APROGRAMFILE2
Last edited: