Google Groups Home
Help | Sign in
How to print ******'s to stout instead of "stty -echo"
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Expand all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
rtbarr  
View profile  
 More options Dec 15 1997, 3:00 am
Newsgroups: comp.unix.shell
From: rtb...@kcc.fsa.usda.gov
Date: 1997/12/15
Subject: How to print ******'s to stout instead of "stty -echo"

I'd like to be able to somehow print asterisks or whatever to the screen
like gui apps do when someone is entering a password.  Is this
possible???

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Barry Margolin  
View profile  
 More options Dec 16 1997, 3:00 am
Newsgroups: comp.unix.shell
From: Barry Margolin <bar...@bbnplanet.com>
Date: 1997/12/16
Subject: Re: How to print ******'s to stout instead of "stty -echo"

In article <882233260.1425539...@dejanews.com>,

 <rtb...@kcc.fsa.usda.gov> wrote:
>I'd like to be able to somehow print asterisks or whatever to the screen
>like gui apps do when someone is entering a password.  Is this
>possible???

I don't think you can do it easily in a shell script.  A C or Perl program
could put the terminal in raw mode and echo *'s.  The program would also
have to handle input editing itself.

--
Barry Margolin, bar...@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Surya V. Avantsa  
View profile  
 More options Dec 17 1997, 3:00 am
Newsgroups: comp.unix.shell
From: "Surya V. Avantsa" <savan...@exchange.ml.com>
Date: 1997/12/17
Subject: Re: How to print ******'s to stout instead of "stty -echo"

Infact this method has an advantage over the windows gui method. In the
windows gui method, when the ** are being displayed, atleast the
stealthy on-looker would know the number of characters in your password.
Whereas in this unix method of stty -echo, the cursor simply does not
move, nor does it display anything on the screen.

Hope that helps. Pls. let me know if it worked.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Surya V. Avantsa  
View profile  
 More options Dec 17 1997, 3:00 am
Newsgroups: comp.unix.shell
From: "Surya V. Avantsa" <savan...@exchange.ml.com>
Date: 1997/12/17
Subject: Re: How to print ******'s to stout instead of "stty -echo"

rtb...@kcc.fsa.usda.gov wrote:

> I'd like to be able to somehow print asterisks or whatever to the screen
> like gui apps do when someone is entering a password.  Is this
> possible???

> -------------------==== Posted via Deja News ====-----------------------
>       http://www.dejanews.com/     Search, Read, Post to Usenet

In your shell script, you could enter stty -echo
This command will turn of echo of user input. Then after the password
entry part is over, say stty +echo. Ex:

echo 'Please enter your password:'
stty -echo
read $passwd
stty +echo
...

...


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Daryl Johnson  
View profile  
 More options Dec 17 1997, 3:00 am
Newsgroups: comp.unix.shell
From: Daryl Johnson <dwjo...@azstarnet.com>
Date: 1997/12/17
Subject: Re: How to print ******'s to stout instead of "stty -echo"

rtb...@kcc.fsa.usda.gov wrote:

> I'd like to be able to somehow print asterisks or whatever to the screen
> like gui apps do when someone is entering a password.  Is this
> possible???

Yes, it is...  Here is some ksh script to do this.

++++++++++++++  START SCRIPT ++++++++++++++
#!/bin/ksh
#Init some stuff...
pass=''
blank='false'

#Main loop executed once for each char typed...
while [ "$blank" != "true" ]
do
  stty raw
  c=`dd bs=1 count=1 2> /dev/null`
  stty -raw

  #Check for a CR.
  if [ -z `echo $c | tr -d "\015"` ]
  then
    blank='true'
  else
    stty echo
    echo "*\c"
    pass=$pass$c
    stty -echo
  fi
done                              
+++++++++++++  END OF SCRIPT ++++++++++++

You may want to check the man pages for dd and for tr if you need
more help with this script.  Feel free to email any follow up ?'s to
me at "dwjo...@azstarnet.com".  I will post the final answers here...

Hope this helps you out....
Dj


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google