Sponsored Content
Full Discussion: Using array in script?
Top Forums Shell Programming and Scripting Using array in script? Post 302765147 by ctsgnb on Friday 1st of February 2013 03:01:12 PM
Old 02-01-2013
instead of modifying the function and add a loop in it,
maybe you could just do a loop which call that function.

But if it's just a matter of performance issue that makes you willing modify the code, maybe you should consider redesigning it completly.

I haven't tried to understand what it does exactly, but at a first look, i would say it is far to be optimized
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Unix script array

Unix shell script; How do I create an array and dynamically populate it with values? How do I retrieve from the array? (4 Replies)
Discussion started by: leemjesse
4 Replies

2. Shell Programming and Scripting

Please Correct this Array Script

Here is the script. I am not able to increment and Print echo "2=" ${arr} (Bold line) Can someone please help me correct it? I am thinking there is some escape sequence error. Just started learning scripts ... Thanks #!/bin/ksh set -A arr a1 a2 a3 a4 # START Server1=gmi ... (6 Replies)
Discussion started by: psreddy1234
6 Replies

3. Shell Programming and Scripting

KSH script not looping through array

Hi All, I'm trying to get a script to loop through an array. The array is basically a list of .zip files. I'd like the script to loop through and unzip the zip files contained in the zip file list. When I run the script, it unzip the first zip file correctly, and then stops Any thoughts? Here's... (2 Replies)
Discussion started by: kelldan
2 Replies

4. Shell Programming and Scripting

How to export an array to perl script?

hi all...... i want to use an array ,declared in bash, in embedded perl script. is there any way to export whole array so that i can use it '$ENV{}' or something.. thanx in advance!! regards, prayush (1 Reply)
Discussion started by: tprayush
1 Replies

5. Emergency UNIX and Linux Support

Problem with Array in Script

Below is my script. This script is getting an error code such as this one. fileListener.bat: entityArray=craig.uss@pnc.com: not found craig.uss@pnc.com fileListener.bat: entityArray=duns_noncusts.txt: not found duns_noncusts.txt fileListener.bat: entityArray=duns_misc.cpy: not found... (4 Replies)
Discussion started by: mkjp
4 Replies

6. Shell Programming and Scripting

A typical array script

Hi All, I need to store the output of "find ." to an array one by one. Output of find . in my case will look like :- . ./one ./one/a ./one/b ./one/c ./two So my first array element should be "/one" and second one "/one/a" (need to remove "." from the output as well). Then I need to... (11 Replies)
Discussion started by: Renjesh
11 Replies

7. Shell Programming and Scripting

sendEmail: Script and Array

I have a script that send email using sendEmail (CentOS shell) script is: sendEmail -vvv -u "TestCompany, Inc.: USB Added" -f user@domain.com -t To@domain.com -s ASPMX.L.GOOGLE.com -m "USB Activity" -o tls=aut o username=user3@domain.com password=password So far this works fine. Now i... (5 Replies)
Discussion started by: kashif.live
5 Replies

8. Shell Programming and Scripting

Array in shell script

Hi, check=("/usr/local/bin/chk_nag | awk -F":" '{print $1}'" "/usr/local/bin/chk_kas | awk -F":" '{print $1}'" "/usr/local/bin/chk_was | awk -F":" '{print $1}'" ) for i in "${check}"; do echo $i; done when I run this. It says Syntax error: "(" unexpected Please advise. (5 Replies)
Discussion started by: ashokvpp
5 Replies

9. UNIX for Advanced & Expert Users

Help in perl script Array.

hi Team, i need a help in perl , i need to get values(10 rows +) from perl GUI and insert those values into oracle table. am trying to achive this in Perl array, can you please help me on this. thanks senthil (1 Reply)
Discussion started by: senkerth
1 Replies

10. Shell Programming and Scripting

Need Shell Script for Array

Hi all, I have an input file like below (a comma seperated file) 345,12,10 400,11,8 328,1,3 I need to get the output as below ... record 345 sum is 12 record 400 sum is 10 record 328 sum is 1 record 345 count is 10 record 400 count is 8 record 328 count... (15 Replies)
Discussion started by: hemanthsaikumar
15 Replies
Net::SIP::Dispatcher::Eventloop(3pm)			User Contributed Perl Documentation		      Net::SIP::Dispatcher::Eventloop(3pm)

NAME
Net::SIP::Dispatcher::Eventloop - simple event loop for Net::SIP::Dispatcher SYNOPSIS
my $loop = Net::SIP::Dispatcher::Eventloop->new; $loop->addFD( $fd, $callback ); $loop->add_timer( 10,$callback ); $loop->loop; DESCRIPTION
The package implements a simple event loop. It's not optimized for speed but it is provided as a simple implementation in case the users application does not has an event loop yet. Because the eventloop object can be given in the constructor of Net::SIP::Dispatcher you might provide an alternative implementation, which implemented the described methods. CONSTRUCTOR
new Creates new event loop, returns created object METHODS
addFD ( HANDLE, CALLBACK, ?NAME ) Adds file handle HANDLE to the event loop, so that CALLBACK gets triggered if HANDLE is readable. CALLBACK is a callback accepted by invoke_callback in Net::SIP::Util. The callback will be invoked with HANDLE as an additional argument. NAME can be used to aid debugging, it will be shown in the debug messages once the FD gets ready. If there was already a callback for HANDLE it gets replaced by the new one. IMPORTANT NOTE: CALLBACK gets triggered if HANDLE *is* readable inside the loop, not if HANDLE *gets* readable. Unlike with Event::Lib or similar the CALLBACK is not triggered by the edge, but by the level (like poll(2) or select(2)). So if 2 bytes come in at the handle and one reads only 1 byte in the callback the callback gets triggered again for more data. You have to watch this, if you want to integrate Net::SIP with your existing event loop. delFD ( HANDLE ) Removes HANDLE from loop, e.g. no more checking for readability will be done. add_timer( WHEN, CALLBACK, [ REPEAT ] ) Adds timer which gets triggered at WHEN or "now + WHEN". Depending on the value of WHEN it gets interpreted as the number of seconds since 1970-01-01 (when it's really big) or as a relative time (when it's not that big). WHEN can be floating point for subseconds resolution. CALLBACK is a callback accepted by invoke_callback in Net::SIP::Util. It gets invoked with the timer object (see later) as an additional argument, which has a method cancel for canceling the (repeating) timer. REPEAT is the number of seconds between each invocation of the timer. If greater then 0 (subsection resulution possible) the callback will be called each REPEAT seconds, after it was called the first time at WHEN. The method will return an object which has a method cancel which can be used to cancel the timer before it gets triggered (or gets triggered the next time in case of repeating timers). looptime Returns the current loop time in subseconds resolution (using gettimeofday from Time::HiRes). This is not the current time, but the time, when the last event in the loop occured (e.g. when the select(2) call returned) loop ( [ TIMEOUT, @STOPVAR ] ) The main loop, e.g. continuiosly checks timers and file handles for the events and calls callbacks. If TIMEOUT is given it will run the loop for at most TIMEOUT seconds, then the method will return. Undefined TIMEOUT means that it will never return because of timeout and TIMEOUT of 0 means that it will check all timers and handles only once and then return. @STOPVAR is a list of scalar references. These scalars are expected to be changed from the callbacks, so it will check after each loop cycle, e.g. after all callbacks are called (timers and handles) if any of these scalars is TRUE, in which case it will end the loop. The behavior with STOPVAR cannot be found in most existing event loops. If you want to integrate Net::SIP with your own event loop you migth simply wrap all callbacks given in addFD and add_timer in another callback which at the end checks the stopvars and terminates the 3rd-party loop in a loop-specific way. perl v5.14.2 2009-01-23 Net::SIP::Dispatcher::Eventloop(3pm)
All times are GMT -4. The time now is 04:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy