Hello,
I have been working on some shell scripts that have a lot of interaction and typing from the user. So, when I test any change, I have to type in about 20 values for variables. And when it goes into actual use, we have about 100 libraries that it will need to run against. So, that is a lot of chance for human error if I leave it as is.
I would like to be able to set up a 'properties'/'config' file that the shell script will read a file and assign the values to the shell vars. I have included one of the interaction files that I'm working with. Thanks in advance for any help.
I have been working on some shell scripts that have a lot of interaction and typing from the user. So, when I test any change, I have to type in about 20 values for variables. And when it goes into actual use, we have about 100 libraries that it will need to run against. So, that is a lot of chance for human error if I leave it as is.
I would like to be able to set up a 'properties'/'config' file that the shell script will read a file and assign the values to the shell vars. I have included one of the interaction files that I'm working with. Thanks in advance for any help.
Code:
#!/usr/bin/bash
#############################################################
#Function aleph_start_menu
#Menu to setup variables for aleph_start file
#############################################################
aleph_start_menu () {
CHOICE="0"
while [ "$CHOICE" = "0" ]
do
clear
echo "Please define variables for aleph_start."
echo
echo "Which variable would you like to modify?"
echo "1.) ORA_HOST: $ORA_HOST"
echo "2.) [URL unfurl="true"]WWW_HOST:[/URL] $[URL unfurl="true"]WWW_HOST"[/URL]
echo "3.) Z39_HOST: $Z39_HOST"
echo "4.) ORACLE_SID: $ORACLE_SID"
echo "5.) HTTPD_PORT: $HTTPD_PORT"
echo "6.) [URL unfurl="true"]WWW_SERVER_PORT:[/URL] $[URL unfurl="true"]WWW_SERVER_PORT"[/URL]
echo "7.) PC_SERVER_PORT: $PC_SERVER_PORT"
echo "8.) OCLC_SERVER_PORT: $OCLC_SERVER_PORT"
echo "9.) Z39_SERVER_PORT: $Z39_SERVER_PORT"
echo "10.) Z39_GATE_PORT: $Z39_GATE_PORT"
echo "11.) SIP2_SERVER_PORT: $SIP2_SERVER_PORT"
echo "12.) SLNP_SERVER_PORT: $SLNP_SERVER_PORT"
echo "13.) NCIP_SERVER_PORT: $NCIP_SERVER_PORT"
echo "14.) SERVER_NAME: $SERVER_NAME"
echo "15.) SERVER_URL: $SERVER_URL"
echo "m.) Return to main menu."
echo "q.) To quit script."
echo "--------------------------"
echo -n "Choice: "
read CHOICE
case "$CHOICE" in
1) echo -n "Change ORA_HOST: "
read ORA_HOST
CHOICE="0"
;;
2) echo -n "Change [URL unfurl="true"]WWW_HOST:[/URL] "
read [URL unfurl="true"]WWW_HOST[/URL]
CHOICE="0"
;;
3) echo -n "Change Z39_HOST: "
read Z39_HOST
CHOICE="0"
;;
4) echo -n "Change ORACLE_SID: "
read ORACLE_SID
CHOICE="0"
;;
5) echo -n "Change HTTPD_PORT: "
read HTTPD_PORT
CHOICE="0"
;;
6) echo -n "Change [URL unfurl="true"]WWW_SERVER_PORT:[/URL] "
read [URL unfurl="true"]WWW_SERVER_PORT[/URL]
CHOICE="0"
;;
7) echo -n "Change PC_SERVER_PORT: "
read PC_SERVER_PORT
CHOICE="0"
;;
8) echo -n "Change OCLC_SERVER_PORT: "
read OCLC_SERVER_PORT
CHOICE="0"
;;
9) echo -n "Change Z39_SERVER_PORT: "
read Z39_SERVER_PORT
CHOICE="0"
;;
10) echo -n "Change Z39_GATE_PORT: "
read Z39_GATE_PORT
CHOICE="0"
;;
11) echo -n "Change SIP2_SERVER_PORT: "
read SIP2_SERVER_PORT
CHOICE="0"
;;
12) echo -n "Change SLNP_SERVER_PORT: "
read SLNP_SERVER_PORT
CHOICE="0"
;;
13) echo -n "Change NCIP_SERVER_PORT: "
read NCIP_SERVER_PORT
CHOICE="0"
;;
14) echo -n "Change SERVER_NAME: "
read SERVER_NAME
CHOICE="0"
;;
15) echo -n "Change SERVER_URL: "
read SERVER_URL
CHOICE="0"
;;
m) main_menu
;;
q) echo "Good-bye!"
exit 1
;;
*) echo "Invalid choice!"
CHOICE="0"
;;
esac
done