Re: ksh script w/o perl

From: John Jolet (john.jolet@FXFN.COM)
Date: Thu Jan 29 2004 - 16:08:39 EST


sure you don't want to use perl? just kidding. how about:
counter=0
var=`cat /etc/oratab|grep -v "#"|grep -v N|cut -8`
for invar in $var; do
  counter=$counter + 1
  varname="DB$counter"
  $varname=$invar
done

haven't tested this, so the second to last line might not work....

On Thursday 29 January 2004 02:44 pm, you wrote:
> Anybody have a quick way to set each line of output from a file to a
> different variable without using perl?
>
> Eg
>
> [root@nad0019aixd05/home..oracle]# cat /etc/oratab|grep -v "#"|grep -v
> N|cut -c -8
>
> PRODUCES two lines:
>
> clipsdv1
> cashsqa1
>
> how can I painlessly set these in a script to variables DB1 and DB2?
>
> Bobby Kelley Jr.
> 972-877-5341



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:33 EDT