# This script prompts for a passwd from stdin while echoing *'s # Prompt MUST be passed as argument to avoid falling into the classic # prompt-before-echo-has-been-disabled mistake. proc getpass {prompt} { stty -echo send_user $prompt set passwd "" expect { -re "\r" {} -re "\b|\1ff" { regexp $passwd (.*). passwd exp_continue -re . { send_user * append passwd $expect_out(0,string) exp_continue } } return $passwd } getpass