Sponsored Content
Top Forums Shell Programming and Scripting Array Variable being Assigned Values in Loop, But Gone when Loop Completes??? Post 302718187 by mrm5102 on Friday 19th of October 2012 10:00:12 AM
Old 10-19-2012
Hey Corona, thanks again for the reply.

Ok, thanks for the clarification...


Hey vgersh99, thanks for your reply.

Cool, another good example. Thanks!


Thanks Again for your Replies,
Matt

---------- Post updated at 10:00 AM ---------- Previous update was at 09:29 AM ----------

Hey Corona, just gave your example a try and it works perfectly..!


Thanks Again,
Matt
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

For Loop and concetnating values in a variable

Hi, I have file abc.txt which has keys and emails addresses abc.txt emailkey1:sam@abc.com emailkey1:tom@abc.com emailkey2:rqw@abc.com emailkey2:tut@abc.com I have a shell script where i pass key as the parameter and i want all the email addresses within that key concatenated by a comma... (21 Replies)
Discussion started by: samit_9999
21 Replies

2. Shell Programming and Scripting

getting values from variable in a loop

I have a set of variables: f1="./someFolder" . . f10="./someOtherFolder" And I'm trying to use the following loop for (( i = 0; i <= 10; i++ )) do temp=f$i done I'm trying the get the values from my set of variable to make directories, but I can't seem the get those value... (3 Replies)
Discussion started by: kriuz
3 Replies

3. Shell Programming and Scripting

How to use array values after the loop.

- I m retreving values from database and wish to use those values later in my shell script. I m placing these values in an array da_data but outside loop array is empty.Problem is its treating array as local inside loop hence array is empty outside loop. Plz go through the script and suggest how... (1 Reply)
Discussion started by: Devesh5683
1 Replies

4. Shell Programming and Scripting

Assigning values to an array via for/while loop

I need to do something like this: for i in 1 2 3 4 5; do arr=$(awk 'NR="$i" { print $2 }' file_with_5_records) done That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop. Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies

5. Shell Programming and Scripting

While loop - how to run processes one after another (2nd starts after first completes, and so on)

I'm a programming noob. I'm trying to run a memory intensive process for many files. But when I use the following script, it runs fine for the first 5-7 files, then runs out of memory. Monitoring the output files, it's clear the processes are going on in parallel. Once 5-7 of the files are being... (18 Replies)
Discussion started by: pathunkathunk
18 Replies

6. Shell Programming and Scripting

awk loop using array:wish to store array values from loop for use outside loop

Here's my code: awk -F '' 'NR==FNR { if (/time/ && $5>10) A=$2" "$3":"$4":"($5-01) else if (/time/ && $5<01) A=$2" "$3":"$4-01":"(59-$5) else if (/time/ && $5<=10) A=$2" "$3":"$4":0"($5-01) else if (/close/) { B=0 n1=n2; ... (2 Replies)
Discussion started by: klane
2 Replies

7. Shell Programming and Scripting

Variable values within for loop

Hi All I am trying to fetch the size of three files into three separate variables within a for loop and am doing something like this: for i in ATT1 ATT2 ATT3 do size_$i=`ls -ltr $i | awk '{print $5}'` echo ${size_$i} done but am getting the below error: ksh: size_ATT1=522: not... (3 Replies)
Discussion started by: swasid
3 Replies

8. Shell Programming and Scripting

How to swap the values in array using for loop?

array=( 8 5 6 2 3 4 7 1 9 0 ) for i in "${array}" do echo $i done # i need the output like this by swapping of array values 0 9 1 7 4 3 2 6 5 8 (7 Replies)
Discussion started by: Meeran Rizvi
7 Replies

9. Shell Programming and Scripting

Convert values in an array using a loop

I have a headerless array of 1000 columns x 100000 rows. The array only contains 4 values; 0/0, 0/1, 1/1, ./. Here I am showing the 1st 3 rows and columns of the input array 0/0 0/0 1/1 0/1 0/1 0/1 0/0 ./. 0/0 0/0 0/0 0/0 I would like to convert the values in... (9 Replies)
Discussion started by: Geneanalyst
9 Replies

10. Shell Programming and Scripting

Array not printing values if used in a loop

Hello! I'm making an English to Morse Code translator and I was able to mostly get it all working by looking through older posts here; however, I have one small problem. When I run it it's just printing spaces for where the characters should be. It runs the right amount of times, and if I try... (3 Replies)
Discussion started by: arcoleman10
3 Replies
Event::RPC::Loop(3pm)					User Contributed Perl Documentation				     Event::RPC::Loop(3pm)

NAME
Event::RPC::Loop - Mainloop Abstraction layer for Event::RPC SYNOPSIS
use Event::RPC::Server; use Event::RPC::Loop::Glib; my $server = Event::RPC::Server->new ( ... loop => Event::RPC::Loop::Glib->new(), ... ); $server->start; DESCRIPTION
This modules defines the interface of Event::RPC's mainloop abstraction layer. It's a virtual class all mainloop modules should inherit from. INTERFACE
The following methods need to be implemented: $loop->enter () Enter resp. start a mainloop. $loop->leave () Leave the mainloop, which was started with the enter() method. $watcher = $loop->add_io_watcher ( %options ) Add an I/O watcher. Options are passed as a hash of key/value pairs. The following options are known: fh The filehandle to be watched. cb This callback is called, without any parameters, if an event occured on the filehandle above. desc A description of the watcher. Not necessarily implemented by all modules, so it may be ignored. poll Either 'r', if your program reads from the filehandle, or 'w' if it writes to it. A watcher object is returned. What this exactly is depends on the implementation, so you can't do anything useful with it besides passing it back to del_io_watcher(). $loop->del_io_watcher ( $watcher ) Deletes an I/O watcher which was added with $loop->add_io_watcher(). $timer = $loop->add_timer ( %options ) This sets a timer, a subroutine called after a specific timeout or on a regularly basis with a fixed time interval. Options are passed as a hash of key/value pairs. The following options are known: interval A time interval in seconds, may be fractional. after Callback is called once after this amount of seconds, may be fractional. cb The callback. desc A description of the timer. Not necessarily implemented by all modules, so it may be ignored. A timer object is returned. What this exactly is depends on the implementation, so you can't do anything useful with it besides passing it back to del_io_timer(). $loop->del_timer ( $timer ) Deletes a timer which was added with $loop->add_timer(). DIRECT USAGE IN YOUR SERVER
You may use the methods of Event::RPC::Loop by yourself if you like. This way your program keeps independent of the actual mainloop module in use, if the simplified interface of Event::RPC::Loop is sufficient for you. In your server program you access the actual mainloop object this way: my $loop = Event::RPC::Server->instance->get_loop; Naturally nothing speaks against making your program to work only with a specific mainloop implementation, if you need its features. In that case you may use the corresponding API directly (e.g. of Event or Glib), no need to access it through Event::RPC::Loop. AUTHORS
Joern Reder <joern at zyn dot de> COPYRIGHT AND LICENSE
Copyright (C) 2002-2006 by Joern Reder, All Rights Reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.10.1 2006-04-23 Event::RPC::Loop(3pm)
All times are GMT -4. The time now is 09:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy