SUMMARY: korn shell vs bourne shell on Solaris 2.5.1

Date: Thu May 08 1997 - 08:07:19 CDT

     Thanks to all who replied:
  (James T Ranks)
     John Justin Hough <>
     John Ballard <>
     Glenn Satchell <> (Vasu Vuppala (DCCI))
     Mike Nibeck <>
     The ORIGINAL question is at the bottom of this message. The majority
     of you answered with the following:
     The pipe that was used runs as a subshell.
     From the sh man pages:
     Because commands in pipelines are run as separate processes, variables
     set in a pipeline have no effect on the parent shell.
     Again, thanks to all who responded.
     Hello all,
     I have a shell script that I am trying to run which parses through our
     Oracle Database file (oratab).
     Korn Shell seems to value a variable within a WHILE statement, and
     re-value it AFTER the WHILE to its original value. Is this normal for
     the Korn shell????
     cat $ORATAB | while read LINE && [ "$db_there" = "NO" ] do
     case $LINE in
     \#*) ;; #comment-line in oratab *)
     ORACLE_SID=`echo $LINE | awk -F: '{print $1}' -`
     # Set up environment and export for called programs if [ "$ORACLE_SID"
     = "${dbn}" ]
     then db_there="YES"
     echo "$ORACLE_SID in oratab : db_there is $db_there."
     ORACLE_HOME=`echo $LINE | awk -F: '{print $2}' -`
     echo "after done, db_there is $db_there"
     if [ "$db_there" = "NO" ]
     then echo "${dbn}:${ORACLE_HOME}:N" >> $ORATAB
     I set db_there to its initial value (NO) at the top. Then db_there is
     set to YES if the value is found in the oratab file. BUT, after the
     script executes the "done" for the "which" statement, it seems to
     re-value db_there to NO again.
     Does anyone have an explanation for this???? Any suggestions would be
     VERY MUCH appreciated.
     Toby Potts
     Policy Management Systems Corporation

This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:11:54 CDT