lock tty use trap/stty -echo command
use exec>file to redirect the stdout of bash process