Re: *NIX shell scripting question (or possibly other scripting methods)
By: Deuce to Khelair on Sun Nov 11 2012 17:29:28
> > Can any shell script wizards out there tell me if there is a way usin
> > 'sh' or 'ksh' to enclose a block of script in some kind of structure that
> > will try to execute something, wait for a predetermined amount of time, a
> > then if there is no user input on the keyboard for that period of time,
> > execute another block of code or else just skip what was going on entirel
>
> I'm not sure exactly what you're asking for... a prompted input with a timeo
Yeah, I think you've got the right idea. Basically I'm looking for a way
in my OpenBSD and one of my Linux systems to make the startup scripts prompt
for a password to unlock encrypted partitions, but to timeout if nobody is
around so that it will still finish the booting sequence and just not provide
access to the encrypted partitions if I'm not available to supply the
passphrase. Using a USB key as the solution is not an alternative I can go
with, either, because I do not want that USB key liable to be seized at any
point and used without my consent.
After a little bit of research somebody on a DOC BBS that I'm a member of
ended up mentioning that bash's 'read -t' function might be able to do what I'm
looking for; it dies and returns failure after the specified number of seconds
if there has been no keyboard input. I was hoping to be able to stick with the
native 'sh' or 'ksh' shells, but if I have to call bash for a small segment of
the shell script it might still not be such a bad alternative.
-=-
Opinions expressed are not necessarily those of the owners or management of
this corporeal rotting porksuit.
-=-
---
■ Synchronet ■ Tinfoil Tetrahedron : telnet bismaninfo.hopto.org 8023 : http:80
80
|