help

Steve Bertrand iaccounts at northnetworks.ca
Tue Dec 9 07:37:40 PST 2003


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 at northnetworks.ca>
> To: "Mümin Maslak" <ymmaslak at hotmail.com>
> Cc: <freebsd-questions at 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 at freebsd.org mailing list
> > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> > > To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at 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



More information about the freebsd-questions mailing list