My question: is possible to write a shell script which will ask for the
ORACLE_HOME, ORACLE_SID, USERNAME, PASSWORD to connect to Oracle db.
In generally we have to set the ORACLE_HOME in .profile file. And after putting the 'sqlplus' command it asks for the username & password for db connection.
if [ -z $ORACLE_HOME ] # True if the length of string string is zero
then
echo "Enter the value of ORACLE_HOME"
read ORACLE_HOME
export $ORACLE_HOME
fi
#!bin/sh
if [ -z $ORACLE_HOME ] # True if the length of string is zero
then
echo "Enter the value of ORACLE_HOME"
read ORACLE_HOME
export $ORACLE_HOME
fi
here is my script but it didn't ask me for the ORACLE_HOME.
if it is not asked, then it means, the ORACLE_HOME is having the value.
if [ -z $ORACLE_HOME ] # True if the length of string string is zero
then
echo "Enter the value of ORACLE_HOME"
read ORACLE_HOME
export $ORACLE_HOME
else
echo "ORACLE_HOME has the value of $ORACLE_HOME"
fi