6

In zsh shell, when you hit Tab twice to get tab completion, your options are displayed below your prompt. But when you make a selection, the options disappear.

I have a little script that outputs passwords to stdout based on keyword search. The only problem is, after I've copied and pasted and I'm done, the passwords stay in the terminal. I would really like to implement this "temporary" output for my passwords script. Is this possible?

1 Answer 1

3

On any system that uses terminfo:

printf "The password is %s " "swordfish"
read -r line
tput cuu1; tput el

Press Enter to erase the password and quit, or Ctrl+C to quit immediately. If your system uses termcap, use tput up; tput ce. This code assumes that the cursor is still on the line with the password by the time the user pressed Enter.

1
  • 1
    Thanks for inadvertently showing me how to use string formatting! Aug 7, 2011 at 20:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .