Newer
Older
tpromptuser / TODO
@tundra tundra on 10 Apr 2014 1 KB *** empty log message ***
Subject: Re: ANN: getkey ('choice.exe' clone for FreeBSD)
Date: Mon, 7 Apr 2014 02:48:35 +0000 (UTC)
From: Mike Sanders <mike@taco-shack.cow>
Organization: FreeBSD
Newsgroups: comp.unix.bsd.freebsd.misc
References: <lhqlh0$lgm$1@news.albasani.net> <gi891b-pl8.ln1@ozzie.tundraware.com>

Tim Daneliuk <tundra@tundraware.com> wrote:

> Yeah, this is a popular thing to implement.  Here's my take:
>
>    http://www.tundraware.com/Software/tpromptuser/

Question... (not to sound like a party pooper here,
its a very nifty script). Why arent you trapping interupts
like SIGINT (CONTROL+C)? It would really help your script...

Here's an example:

#!/bin/sh -e

<<COMMENT

error-level table:

0     Normal
1     SIGHUP
2     SIGINT
15    SIGTERM

COMMENT

trap 'graceful_exit' 1 2 15

graceful_exit() {

  echo  'put cleanup routines here...'
  exit 1

}

echo 'invoke control+c for example'

sleep 10

echo 'script exited normally'

# eof
 
> A more widely used tool is the 'dialog' package:
 
Aye, a really great tool for gui-ified scripts, I use it too:

<http://freebsd.hypermart.net/glyphs/topic-dialog.png>

-- 
Mike Sanders
www: http://freebsd.hypermart.net
gpg: 0xD94D4C13