Sponsored Content
Top Forums Shell Programming and Scripting Limiting the hanging of a function inside a loop Post 302234663 by Niroj on Wednesday 10th of September 2008 04:36:09 AM
Old 09-10-2008
MySQL

I tried this program with using for loop...

=========================================
set -x

f()
{

enccp -c mas start serv_nm -v -myPwd encina_admin

}

i=0
for i in 1 2
do
f &
x=`jobs -p`
{ sleep 1; kill -9 $x; } &>/dev/null &
wait $x
date
i=`expr $i + 1`
done

===========================================

OUTPUT:
-------------

[/home2/niroj_p]./fun
+ i=0
+ + f
+ enccp -c mas start serv_nm -v -myPwd passwd
+ jobs -p
x=0
+ sleep 1
+ 1> /dev/null
+ wait 0
+ date
Wed Sep 10 13:57:24 IST 2008
+ + expr 1 + 1
i=2
+ f
+ + enccp -c mas start serv_nm -v -myPwd passwd
+ + jobs -p
x=0
0
0
+ sleep 1
+ 1> /dev/null
+ wait 0 0 0
+ date
Wed Sep 10 13:57:24 IST 2008
+ + expr 2 + 1
i=3
[/home2/niroj_p]starting serv_nm
retrieving attributes of object serv_nm ... done
setting up the server resources
retrieving node object mars6 ... done
creating file system path /var/opt/encina/local/subsys/encina/css6/server/serv_nm ... exists
retrieving encina server group name ... done
retrieving encina administration organization ... done
starting serv_nm
retrieving attributes of object serv_nm ... done
setting up the server resources
retrieving node object mars6 ... done
creating file system path /var/opt/encina/local/subsys/encina/css6/server/serv_nm... exists
retrieving encina server group name ... done
retrieving encina administration organization ... done
+ kill -9 0 # Kill is working nice

=====================
After this I have to enter any key to come out from the process.
That I want to avoid..


Thank u friends...Smilie
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

value inside a function

i have a script like this #!/bin/ksh initialize() { x=20 } ... ... ... x=10 initialize; echo $x (2 Replies)
Discussion started by: trichyselva
2 Replies

2. Shell Programming and Scripting

Function's return value used inside awk

I have a file with the record of person: cat > $TMP/record.txt John Torres M Single 102353 Address Mark Santos M Maried 103001 Address Carla Maria F Maried 125653 Address #!/bin/ksh ManipulateID(){ ... return 0; ... #or return 1; } cat $TMP/record.txt | awk 'BEGIN {printf... (4 Replies)
Discussion started by: Orbix
4 Replies

3. HP-UX

Limiting SFTP Users While Not Limiting Regular Users?

Hi, I have searched the web and have come back with nothing that is satisfactory for what I require. SFTP is my corporations new file transfer standard. What I require is a method to lock down SFTP users to their directory (they may go to sub directories) while not restricting regular users. ... (2 Replies)
Discussion started by: Emancipator
2 Replies

4. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

5. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

6. Shell Programming and Scripting

PERL - press Enter function hanging

Hi, I have a sub function called pressEnter within my perl menu script which basically means that the script will await an interaction from the user before moving on. Unfortunately when the script goes into pressEnter it just hangs (even if you press enter!!). Any ideas on what could be... (4 Replies)
Discussion started by: chris01010
4 Replies

7. Programming

Changing value inside function

I have the following code and want to update shiftDesc inside the function. Is it correct to declare the argument as: int shiftDesc void prValue_vd( FILE* stream, // name of output stream int shift, // amount of shift to the right const char* value,... (1 Reply)
Discussion started by: kristinu
1 Replies

8. Shell Programming and Scripting

If loop inside function not working.

check_deplver () { dir=/abc/def/ghi if ssh -o StrictHostKeychecking=no $1 "" 2> /dev/null then echo " output is " ssh -o StrictHostKeychecking=no $1 "ls -lrt $dir | grep -i abc" 2> /dev/null else echo " directory not presnt" fi } This is not working. But... (7 Replies)
Discussion started by: NarayanaPrakash
7 Replies

9. UNIX for Dummies Questions & Answers

Write a while loop inside for loop?

I'm taking a unix class and need to countdown to 0 from whatever number the user inputs. I know how to do this with a while or until loop but using the for loop is throwing me off.... I know I can use an if-then statement in my for loop but can I include a while loop in my for loop? (3 Replies)
Discussion started by: xxhieixx
3 Replies

10. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies
voice_set_playmode(3alleg4)					  Allegro manual				       voice_set_playmode(3alleg4)

NAME
voice_set_playmode - Adjusts the loop status of the specified voice. Allegro game programming library. SYNOPSIS
#include <allegro.h> void voice_set_playmode(int voice, int playmode); DESCRIPTION
Adjusts the loop status of the specified voice. This can be done while the voice is playing, so you can start a sample in looped mode (hav- ing set the loop start and end positions to the appropriate values), and then clear the loop flag when you want to end the sound, which will cause it to continue past the loop end, play the subsequent part of the sample, and finish in the normal way. The mode parameter is a bitfield containing the following values: PLAYMODE_PLAY Plays the sample a single time. This is the default if you don't set the loop flag. PLAYMODE_LOOP Loops repeatedly through the sample, jumping back to the loop start position upon reaching the loop end. PLAYMODE_FORWARD Plays the sample from beginning to end. This is the default if you don't set the backward flag. PLAYMODE_BACKWARD Reverses the direction of the sample. If you combine this with the loop flag, the sample jumps to the loop end position upon reaching the loop start (ie. you do not need to reverse the loop start and end values when you play the sample in reverse). PLAYMODE_BIDIR When used in combination with the loop flag, causes the sample to change direction each time it reaches one of the loop points, so it alternates between playing forwards and in reverse. SEE ALSO
Allegro version 4.4.2 voice_set_playmode(3alleg4)
All times are GMT -4. The time now is 05:22 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy