From: sverre@research.nokia.com (Sverre Slotte)
To: zsh-workers@math.gatech.edu
Subject: zsh: read with timeout?
Date: Thu, 9 Nov 1995 10:18:42 +0200 [thread overview]
Message-ID: <9511090818.AA23545@nike.spices> (raw)
Gurus and mere mortals,
Is there a way to give the read-command (in zsh) a timeout-value?
When I log in to my workstation, I want my login-script to ask me
which window manager to run. If I don't answer anything, I want it to
run the default manager.
My present solution is a kludge: I spawn off a subprocess which sleeps
for a while and then sends a signal to the parent process. This signal
lets the script break out of the read.
Is there a better way?
This is the relevant part of my .zlogin file:
-------------------------------------------------------
if [[ $TTY = /dev/console && -a /dev/fb ]]
then
# Choose window manager. If no input within specified period of
# time, a default is chosen. "Interesting" hack handles timeout
# process.
nop() { } # dummy func def
trap nop INT # trap ^C
( sleep 15; kill -INT $$ 2>/dev/null ) &
disown %%
echo -n "Console, Fvwm, Motif, OpenWindows or SunView? "
read answer
# fvwm is my default window manager, hence "${answer:-f}".
case ${answer:-f} in
c|C) # this should leave us on the console
;;
f|F) export XINITRC=.xinitrc.fvwm
openwin -ar1 250 -ar2 25 -nobanner
clear
logout
;;
m|M) export XINITRC=.xinitrc.mwm
/usr/bin/X11/mwm
clear
logout
;;
o|O) # kbd-def's in file .SverreKeys.ps
export XINITRC=.xinitrc.olwm
openwin
clear
logout
;;
s|S) loadkeys ~/.setkbd.swe
sunview
clear
logout
;;
*) # should we do something here?
;;
esac
fi
-------------------------------------------------------
Sverre
----------------------------------------------------------------------------
Sverre Slotte Internet: sverre@research.nokia.com
Nokia Research Center Phone: + 358 0 43766208
P.O.Box 45, 00211 Helsingfors, Finland Phax: + 358 0 43766856
----------------------------------------------------------------------------
"Kajakken er uten sammenligning den ypperste enkeltmannsfarkost som finnes."
-- Fritjof Nansen 1891
next reply other threads:[~1995-11-09 8:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
1995-11-09 8:18 Sverre Slotte [this message]
1995-11-09 13:37 ` Vinnie Shelton
1995-11-12 0:05 Karl E. Vogel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9511090818.AA23545@nike.spices \
--to=sverre@research.nokia.com \
--cc=zsh-workers@math.gatech.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).