Re: script question

From: Lieberg, Patrick (plieberg@EV3.NET)
Date: Tue Feb 10 2004 - 13:01:45 EST


Arrays work great for this. Something like this maybe:

while ((count <= 2))
do
        redo[$count]=/directory/$count
        echo ${redo[$count]}
        ((count = count +1))
done

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU]On Behalf Of
Bob.Kelley@BRINKSINC.COM
Sent: Tuesday, February 10, 2004 11:42 AM
To: aix-l@Princeton.EDU
Subject: Re: script question

Thks Joseph, but what I was trying to accomplish was putting this inside a
loop and using my loop variable for the redo_1 variable

in other words, I'm trying to append $count to $redo_ and get $redo_1,
$redo_2 and so on in a big loop.

Does that make sense???

Bobby Kelley Jr.
972-877-5341

|---------+----------------------------->
| | JOSEPH KREMBLAS |
| | <jkremblas@REDHEAR|
| | TGIFTS.COM> |
| | Sent by: IBM AIX |
| | Discussion List |
| | <aix-l@Princeton.E|
| | DU> |
| | |
| | |
| | 02/10/2004 11:34 |
| | AM |
| | Please respond to |
| | IBM AIX Discussion|
| | List |
| | |
|---------+----------------------------->
>--------------------------------------------------------------------------------------------------------------------------------------------------|
  | |
  | To: aix-l@Princeton.EDU |
  | cc: |
  | Subject: Re: script question |
>--------------------------------------------------------------------------------------------------------------------------------------------------|

Bob,

        The statement:

                export variable_test=${redo_}${count}

        is missing '1' in the redo_ variable; it should be:

                $(redo_1}

Regards,
Joseph

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of
Bob.Kelley@BRINKSINC.COM
Sent: Tuesday, February 10, 2004 10:20 AM
To: aix-l@Princeton.EDU
Subject: Re: script question

Thks for the response Bill, maybe I'm missing something here:

export count=1
export redo_1=/tmp
export variable_test=${redo_}${count}

echo $variable_test
Yields "1"

Whats wrong with my syntax?

Bobby Kelley Jr.
972-877-5341

|---------+---------------------------->
| | Bill Verzal |
| | <BVerzal@KOMATSUN|
| | A.COM> |
| | Sent by: IBM AIX |
| | Discussion List |
| | <aix-l@Princeton.|
| | EDU> |
| | |
| | |
| | 02/10/2004 10:40 |
| | AM |
| | Please respond to|
| | IBM AIX |
| | Discussion List |
| | |
|---------+---------------------------->

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|
  |
|
  | To: aix-l@Princeton.EDU
|
  | cc:
|
  | Subject: Re: script question
|

>-----------------------------------------------------------------------
------------------------------------------------------------------------
---|

${REDO_MP_TO}_${DB_COUNT}
--------------------------------------------------------

"If everything is coming your way, then you are in the wrong lane"

Bill Verzal
AIX Administrator, Komatsu America
(847) 970-3726 - direct
(847) 970-4184 - fax

             Bob.Kelley@BRINKS
             INC.COM
             Sent by: IBM AIX
To
             Discussion List aix-l@Princeton.EDU
             <aix-l@Princeton.
cc
             EDU>

Subject
                                       script question
             02/10/2004 10:26
             AM

             Please respond to
                  IBM AIX
              Discussion List
             <aix-l@Princeton.
                   EDU>

I have two variables which are holding spots for mount points.

for i in 1 2
do
      export xx=DB$DB_COUNT=$i
      export REDO_MP_TO_$DB_COUNT=/apps/"$i"
done

Now I want to use them with commands and such

EG.
...
for i in 1 2
do
      cd $REDO_MP_TO_$DB_COUNT
done

but this fails to evaluate correctly in the second loop. How do I get
the $REDO_MP_TO_$DB_COUNT to be recognized as "/apps/1" and "/apps/2"
for input to the cd command?

Bobby Kelley Jr.
972-877-5341

NOTICE TO BRINK'S EMPLOYEES:
All electronic mail communications composed, sent, received or stored on
or through Brink's equipment are subject to the Brink's Electronic
Communications Policy. Employees should have no expectation of privacy
in their use of the Company's electronic mail system

NOTICE TO BRINK'S EMPLOYEES:
All electronic mail communications composed, sent, received or stored on or
through Brink's equipment are subject to the Brink's Electronic
Communications Policy. Employees should have no expectation of privacy in
their use of the Company's electronic mail system.

_____________________________________________________________________
Message scanned for viruses



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