- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: User password
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 07:04 AM
03-22-2006 07:04 AM
I am runing a script which prompt for user to input the password I turn off the echo so that the password doesn't echo (stty -echo), now what I want is to echo **** when user input the password, can some one help how to achive this.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 07:46 AM
03-22-2006 07:46 AM
SolutionUse the attached small program. It's done in K&R C intentionally so that even the Bundled compiler willl handle it. It also filters out unprintable characters.
Compile it like this:
cc onechar.c -o onechar
Now install onechar somewhere in your PATH (e.g. /usr/local/bin).
You can invoke it as "onechar -u" for usage.
Use it like this:
#!/usr/bin/sh
typeset -i STAT=0
typeset PW=""
typeset X=""
echo "Enter password: \c"
while [[ ${STAT} -eq 0 ]]
do
X=$(onechar)
STAT=${?}
if [[ ${STAT} -eq 0 ]]
then # printable character read
echo "*\c"
PW="${PW}${X}"
fi
done
echo
echo "Password = \"${PW}\""
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 08:23 AM
03-22-2006 08:23 AM
Re: User password
./test1: typeset: not found
./test1: typeset: not found
./test1: typeset: not found
Enter password: ./test1: syntax error at line 10: `X=' unexpected
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 08:27 AM
03-22-2006 08:27 AM
Re: User password
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-22-2006 08:34 AM
03-22-2006 08:34 AM