[SunHELP] Scripting Question

Ledger, David sunhelp at sunhelp.org
Mon Mar 26 02:26:57 CST 2001


Start with something like (in ksh):

	(read x </dev/tty) &
	readpid=$!
	(sleep 10; kill $readpid) &
	sleeppid=$!
	fg %-
	kill -0 $sleeppid && kill $sleeppid

The last line just prevents 'kill: nnnn: no such process' messages if you
use the keyboard exit.
This doesn't work on any key i/p, there has to be a <return>.
The above works when typed in.  Havn't tried the exact above in a script,
but I do have a script somwhere that uses this approach.
Putting '>/dev/null 2>&1' in various places once you've got it going will
reduce spurious output.

The Version 6 system I first learned Unix on had a simpler method in it's
boot up sequence, but I've never been able to figure out what it was since.
It only had one b/g process.

David

This is my opinion only, and not that of my employer who is ... me ..
Unless the contents indicate otherwise, it has no connection with my current
client whose email services I am using.
David Ledger - Freelance Unix SysAdmin & chair of HP/Works SysAdmin SIG
dledger at ivdcs.demon.co.uk - becoming dledger at ivdcs.co.uk
www.ivdcs.demon.co.uk - becoming www.ivdcs.co.uk



v v v v v v v v
 Hello Every one,

 I have a shell script which in one stage o its run sleeps for defined time
 period (which is hard coded).
 I want the script to sleep and continue after the sleep time, but if a key
 on the key board is pressed it should come out of the sleep and continue
 before it completes the sleep cycle.
 Any pointers
=====================================================================
This email and any files transmitted with it are confidential and 
intended solely for the use of the individual or entity to whom they   
are addressed. If you have received this email in error please notify 
gpupower.co.uk or postmaster at npower.com

This outgoing e-mail (and any attachments) has been checked
(using Sophos Sweep 3.43 + patches) before leaving us (UK 08457 353637),
and has been found to be clean from any virus infection.

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



More information about the SunHELP mailing list