[ILUG] kbhit() for bash?

Kenn Humborg kenn at bluetree.ie
Mon Sep 4 12:20:55 IST 2000


> Mornin,
> 	Quick question for the bash gurus:
> Is there any way to test to see if there is something
> on stdin? I'm writing a small script to monitor a file,
> to see if it changes. Every second the script wakes up and checks.
> I want to be able to press a key at any time and spawn a program.
> But I don't want the script to be waiting for key input. Any ideas?

Write a small program that is spawned by the script that
sends the script a SIGUSR1 when a key is hit.

Then use 'trap' to deal with this signal in the script.

Later,
Kenn





More information about the ILUG mailing list