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

Re: OT:programmin questions



On Sun, 16 Dec 2001 18:54:59 -0500, David Bellows <bfootdav@mindspring.com> wrote:

[snip]
> not a programmer as you'll quickly notice.  My problem is that I have 
> to enter a key followed by ENTER.  This is obviously cumbersome when 

Probably the input is being buffered.  But you need to be able to
read each charachter immediately.  I believe there's a way to turn
off input buffering on STDIN via bash, but at the moment I don't
recall the magic to do so...  I think you might want to setup
the "read" function to only read one character at a time (by default,
I think it is line buffered).  Look up how to do those things, and
I think you'll be on your way...

> using a remote control.  Does bash have a way around this?  Should I be 
> using another language?  If the latter, I would prefer, for now, a 
> scripting language -- thinking this would be easier to figure out as I 
> need to learn new things.
> 
> #!/bin/sh
> while [ "$choice" != q ]
> do
> read choice
> case "$choice" in
>     a) /usr/local/bin/jac -P1;; #jac is a command line CD player
>     b) /usr/local/bin/jac -P5;;
>     c) /usr/local/bin/jac -k;;
>     #First kill the CD and then start DVD player
>     d) /usr/local/bin/jac -k; /usr/local/bin/ogle -u cli;; 
>     q) /usr/local/bin/jac -k;;
> esac
> done
> exit 0
> 
> Thanks everyone.  A push in the right direction might be all I need, 
> maybe even just some good online resources that can get me going 
> quickly.  
> 
> David Bellows
> 
> 
> -- 
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org 
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 


-- 
Eric G. Miller <egm2@jps.net>



Reply to: