[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

select: want to let user leave with just a RET

From: Dan Jacobson
Subject: select: want to let user leave with just a RET
Date: 25 Jun 2002 07:22:43 +0800
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2

select: select NAME [in WORDS ... ;] do COMMANDS; done
    ...to that word.  If the line is empty, WORDS and the prompt are
    redisplayed.  If EOF is read, the command completes...

The only thing bugging me about this is that I want to let the user go
if he enters just a RET.  Apparently this is not possible.  Perhaps a
"select -e" should be added so the user can get out with just a RET
instead of fancy C-d, C-c.

BTW, one blunders forth issuing the command even for an invalid
choice... OK, I'm sure you've all figured this out already and there
are uses for the default behavior, but I had to armor my script
#In leafnode it is too hard for the user to remove news from the queue:
#Therefore I have wipped up this which will ask you which one to delete.
test $# -ne 0 && { echo $0: no args allowed 1>&2; exit 33;}
: ${outgoing_dir=/var/spool/news/out.going}
test -w $outgoing_dir ||
     { echo $0: you can\'t remove articles from $outgoing_dir 1>&2; exit 34;}
set -- $(newsq|awk -F: '/^[0-9]/{print $1;$0=++a") "$0};{print>"/dev/tty"}')
echo remove which message\? q to quit
select message
  case $REPLY in q)break; esac
  rm -v $outgoing_dir/${message:?bad choice}
BTW, it seems there is no way at all to use a RET instead of q
note also the :? to avoid the gun firing even if the user picked a
number not on the list ... [ok, otherwise I couldn't use q...] OK,
obviously this is meant to be flexible and my complaints would just
make it less configurable.
http://jidanni.org/ Taiwan(04)25854780

reply via email to

[Prev in Thread] Current Thread [Next in Thread]