I have a ksh script with the following code and working fine under ksh.
IFS=$IFS
IFS=:
while read a b c
do
test "$a" = "$oraserver" && { orahome=$b; break; }
echo $orahome
done < /var/opt/oracle/oratab2
IFS=$_IFS
ORACLE_HOME=$orahome;export ORACLE_HOME
If I run this code under bash , it's setting ORACLE_HOME=''.
can somebody tell me what I am missing under bash or do I need to modify it for bash ?
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.
# A colon, ':', is used as the field terminator. A new line terminates
# the entry. Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
# $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively. The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
+ASM1:/opt/oracle/product/11.1.0/racasm:N
abc:/opt/oracle/product/11.1.0/racdb:N
def:/opt/oracle/product/11.1.0/racdb:N
ghi:/opt/oracle/product/11.1.0/racdb:N
jkl:/opt/oracle/product/10.2.0/racdb:N
The only thing I've learnt here is that I'm adding bash to my list of shells that I actively dislike! Give me the nice ksh (vi) editing command-line ways anyday!
Here's what I did:
I created a file called oratab2, adding what you said:
If you really want tortured command-line editing, you can use "set -o vi" in bash, just as I can get an almost-usable command line in ksh with "set -o emacs".
I confess it was a cheap shot, and didn't add to the "knowledge base", but when you spend 90% of your life pressing escape-k, the up arrow just isn't where it needs to be when you need it!