🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: es.comp.os.linux.programacion
Article #15838

Re: Asignar teclas con bash

#15838
From: J.A. Gutierrez
Date: Fri, 02 Jun 2000 00:00
36 lines
1637 bytes
Esteban <scandisk@ctv.es> wrote:

: read s
: if test $s = 1
: echo "1"
: then
: echo "otro"
: fi


: �C�mo hacer para que en vez de darle al 1 y enter, en este ejemplo
: chorra, se ejecute directamente al apretar 1? Sin tener que darle al
: "enter".


===========================================================================
#!/bin/sh

ReadKey()
{
	Oldstty=`stty -g`
	stty -icanon -echo min 1 time 0
	dd bs=1 count=1 2>/dev/null
	stty $Oldstty
}

key=`ReadKey`

echo $key
===========================================================================

-- 
PGP and other useless info at      \                 Oh, show us the way
http://www.cps.unizar.es/~spd/      \             to the next whisky bar
finger://daphne.cps.unizar.es/spd    \                      Weill/Bretch
es doloroso ser sabio y descubrir la sopa de ajo                   (Pla)
Technical Details
Message-ID: <8h8esr$sps$2@news.unizar.es>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <slrn8jdos1.74g.scandisk@localhost.localdomain>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f86c8,d471714db8bf4620,start
X-Google-Attributes: gidf86c8,public
From: "J.A. Gutierrez" <spd@daphne.cps.unizar.es>
Subject: Re: Asignar teclas con bash
Date: 2000/06/02
Message-ID: <8h8esr$sps$2@news.unizar.es>
X-Deja-AN: 630225433
Content-Transfer-Encoding: 8bit
References: <slrn8jdos1.74g.scandisk@localhost.localdomain>
Content-Type: text/plain; charset=ISO-8859-1
X-Complaints-To: usenet@news.unizar.es
X-Trace: news.unizar.es 959954651 29500 155.210.152.20 (2 Jun 2000 14:04:11 GMT)
Organization: Rank
Mime-Version: 1.0
User-Agent: tin/1.4.1-19991201 ("Polish") (UNIX) (IRIX/6.2 (IP22))
NNTP-Posting-Date: 2 Jun 2000 14:04:11 GMT
Newsgroups: es.comp.os.linux.programacion