The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing a variable from a child script back to the parent Andy82 Shell Programming and Scripting 3 05-26-2008 09:52 PM
Parent/child Korn shell script help sasaliasim Shell Programming and Scripting 1 05-06-2008 05:09 PM
terminating script with CTRL+D sanchopansa Shell Programming and Scripting 12 10-26-2006 04:22 AM
How to know parent script name from child script raki Shell Programming and Scripting 2 06-05-2006 08:01 AM
return valuse from child script to parent script borncrazy Shell Programming and Scripting 1 08-20-2004 03:39 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-02-2007
mervin2006 mervin2006 is offline
Registered User
  
 

Join Date: Nov 2006
Posts: 15
Terminating child script without terminating the parent script

Hi
I was working on a shell script with randomly shows a page of text from a randomly selected topic .As soon as the page is displayed it callers a timer script which keeps on running indefinitely until the timer script is killed by the user.

This is where I have the problem,if I press Cntrl-C then even the parent script gets terminated.This is what my code looks like

cat ${file_nm} |head -$line_count | tail -100

timer.ksh

I tried modifying it to try the get the PID of the timer script and kill it like this below if the user enters 0 ,but even that doesn't seem to work

cat ${file_nm} |head -$line_count | tail -100

bg timer.ksh


PID=$$
echo $PID

read kill_proc
if [[ $kill_proc -eq 0 ]]
then

kill $PID
fi

I tried something like this but even this doesn't seem to work ,can you give me suggestions to just kill the timer script interactively which terminating the parent script as well

The timer script is just a simple infinite while loop

while true
do

sleep 1
done

Thanks for any help

Mervin Johnsingh

Last edited by mervin2006; 05-02-2007 at 02:01 AM..
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 01:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0