Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

K Shell ---- Making text input invisible

Status
Not open for further replies.

SpongeBob1

Programmer
Mar 1, 2002
49
US
Hi,

Is there a function in K Shell I can use which hides screen input from the user? IN other words I wish to make input invisible.

Thanks,
Diarmuid.
 
Hi,

you can use the stty command :

stty -echo # Disable echoing input characters
stty echo #Enable echoing input characters Jean Pierre.
 
Hi Jean Pierre,

Thanks for the tip.

Much Appreciated,
Diarmuid.
 
hi all,

I like to read line from a file till the end of the file by using while.
within the while loop i like to get the input from keyboard.
the problem is that the read input command is reading the input from file not from

keyboard

ex:

#!/bin/ksh

while read line
do
read input#this line talking the input from filename,
#but it should take from keyboard
case $input in
1) call_this;;
2) call_that;;
esac
done<filename

How to solve this problem
 
One way would be to determine the users TTY and specifically tell the 2nd read to use it ... a rough example ...

#!/bin/ksh
TTY=$(who am i|awk '{print $2}')
while read line
do
read input < /dev/$TTY
case $input in
1) call_this;;
2) call_that;;
esac
done<filename

Greg.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top