Re: BASH Scripting
Aaron Konstam <[email protected]>
| Newsgroups | gmane.linux.redhat.release.enigma |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Mar 18, 2003 at 05:17:08PM -0000, David Nithakorne wrote:
> I am trying to set the value of SIDS in the following script to
> something other than "". It seems that once out of the do/done block the
> value od $SIDS reverts back to ""....why is this and how can I get $SIDS
> to keep its new value opnce out of the do/done block.
>
> # !/bin/sh
> SIDS=""
> grep -v '^#' /etc/oratab | while read LINE
> do
> ISID=`echo $LINE | cut -f1 -d:`
> OHOME=`echo $LINE | cut -f2 -d:`
> OBOWNER=`ls -l $OHOME/bin/sqlplus | awk '{print $3}'`
> SIDS=`echo "$SIDS $OBOWNER:$ISID"`
> echo "SIDS is $SIDS"
> done
> echo SIDS is $SIDS
> echo "OBOWNER is $OBOWNER"
>
> the /etc/oratab file is: -
>
> #
> #
> LD4U:/opt/oracle/product/9.2.0:Y
> oem:/opt/oracle/product/9.2.0:Y
> ld4udev:/opt/oracle/product/9.2.0:Y
>
> Thanks
>
> David
>
Just export $SIDS after it is defined.
--
-------------------------------------------
Aaron Konstam
Computer Science
Trinity University
715 Stadium Dr.
San Antonio, TX 78212-7200
telephone: (210)-999-7484
email:[email protected]