Mailinglist Archive: opensuse (2348 mails)

< Previous Next >
Re: [opensuse] Quick bash question - testing for the presence of keyboard input without pausing a loop?
  • From: "David C. Rankin" <drankinatty@xxxxxxxxxxxxxxxxxx>
  • Date: Sat, 05 Apr 2008 11:18:35 -0500
  • Message-id: <47F7A65B.4050402@xxxxxxxxxxxxxxxxxx>
Sam Clemens wrote:
David C. Rankin wrote:

I'm stuck. I would like to write a bash routine that tests for the presence of a user keypress ('q' or 'e') to exit a loop from within the loop without stopping the loop to wait like with read. Basically just execute the loop until the user presses a key, any key, to stop it. I can't figure out how do that will a keypress.

As a work around, I'm using a basic file ".runmcelog" file for that purpose:

while [ -f "/home/david/.runmcelog" ]; do
sudo /usr/sbin/mcelog --k8

I would fork off the rest of the processing code in the background.

Like this

(sorry Sam, you'll get two copies.. oops.)

Bingo! You hit the nail on the head. Thanks to all that responded. Now I
have "several" more arrows to add to my quiver....

David C. Rankin, J.D., P.E.
Rankin Law Firm, PLLC
510 Ochiltree Street
Nacogdoches, Texas 75961
Telephone: (936) 715-9333
Facsimile: (936) 715-9339

To unsubscribe, e-mail: opensuse+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: opensuse+help@xxxxxxxxxxxx

< Previous Next >
This Thread