1834305 Members
2520 Online
110066 Solutions
New Discussion

Customizing shell prompt

 
SOLVED
Go to solution
Ridzuan Zakaria
Frequent Advisor

Customizing shell prompt

Hi,

I am writing a script to automate some database jobs. The script will prompt use to enter password their password. To avoid the password from being display on the screen while user entering it, I am setting the foreground and background to the same color using setaf and setab.

But I am still having an issue. The cursor is still moving when user typing their password.

How do I hide the cursor too?

Thanks.
quest for perfections
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Customizing shell prompt

Rather than doing tputs setaf why don't you instead do a 'stty -echo'?

It is very important when doing stty's or tputs that you have a trap that does a "stty sane" so that the terminal is restored to a sane state after you process termimates normally or receives a signal. The stty's and tput's apply not to the process but to the terminal so even after the process terminates, if the terminal has not been restored, it is left in the state as of the last stty or tputs.
If it ain't broke, I can fix that.
Ridzuan Zakaria
Frequent Advisor

Re: Customizing shell prompt

Thanks for the solution.
quest for perfections