Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Dec 2003 10:37:11 -0500
From:      Steve Bertrand <iaccounts@northnetworks.ca>
To:        =?ISO-8859-1?Q?M=FCmin?= Maslak <ymmaslak@hotmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: help
Message-ID:  <1070984230.391.18.camel@ptp.northnetworks.ca>
In-Reply-To: <BAY1-DAV43KHvyo3DjF000061fa@hotmail.com>
References:  <BAY1-DAV39Ln5U9T3TG0000629d@hotmail.com> <1070976839.391.1.camel@ptp.northnetworks.ca> <BAY1-DAV43KHvyo3DjF000061fa@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
You forgot to Cc: list, so here it is:

> Could you give me an example ?

---- start script ----

#!/usr/bin/perl

print ("Hit any key: ");

$userVar = <>;

if ($userVar eq "\n") {
        print "You hit the enter key!\n";
} else {
        print "You did not only hit the enter key!\n";
}

---- end script ----

Technically, no ascii required, just had to check for a return.

Steve

> ----- Original Message -----
> From: "Steve Bertrand" <iaccounts@northnetworks.ca>
> To: "Mümin Maslak" <ymmaslak@hotmail.com>
> Cc: <freebsd-questions@freebsd.org>
> Sent: Tuesday, December 09, 2003 3:34 PM
> Subject: Re: help
> 
> 
> > > I use FreeBSD4.7
> > > On script, how can I run the function of return/enter key ?
> > >
> >
> > Depends on what type of script. In a Perl script, you can do this so the
> > user has to interact with the keyboard:
> >
> > $userVar = <>;
> >
> > and then you could potentially do some ASCII checking to make sure it
> > was the enter key they pressed.
> >
> > Steve
> >
> > > thanks
> > > _______________________________________________
> > > freebsd-questions@freebsd.org mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe@freebsd.org"
> > --
> >
> > Steve Bertrand
> > President/CTO,
> > Northumberland Network Services
> >
> > t: 905.352.2688
> > w: www.northnetworks.ca
> >
> >
-- 

Steve Bertrand
President/CTO,
Northumberland Network Services

t: 905.352.2688
w: www.northnetworks.ca



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1070984230.391.18.camel>