shell skripty case yes / no - poradte
Ladislav Vaiz
spam na nagano.cz
Pondělí Říjen 31 13:27:18 CET 2005
On Mon, 31 Oct 2005, Vancl Miroslav (QRIS) wrote:
> >> znate nekdo odkaz na nejaky priklady shel skriptu, kde napr.
> provadim
> >> urcitou akci a chci pockat treba 10 sekund na reakci uzivatele -
> stisk
> >> klavesy Y/N, po 10 sekundach pokracovani...
Muzete pouzit expect, priklad /usr/share/doc/expect/examples/timed-read:
#!/bin/sh
# \
exec expect -f "$0" ${1+"$@"}
# read a complete line from stdin
# aborting after the number of seconds (given as an argument)
# - Don Libes
set timeout $argv
expect -re \n {send_user $expect_out(buffer)}
v bashi pak neco jako:
answer=`timed-read 10`
Doporucuji projit i ostatni priklady k expect, je to uzitecny program.
La'd"a
Další informace o konferenci Linux