Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 3 down vote accepted

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.

share|improve this answer
Thanks for inadvertently showing me how to use string formatting! – Matt Alexander Aug 7 '11 at 20:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.