如何在MinTTY下关闭echo?
我有一个在MinTTY(cygwin的shell)下运行的程序,调用如何在MinTTY下关闭echo?,c,windows,shell,mintty,C,Windows,Shell,Mintty,我有一个在MinTTY(cygwin的shell)下运行的程序,调用GetConsoleMode/SetConsoleMode失败\u getch也会回显到控制台。这是一个本机win32应用程序,没有绑定到cygwin环境,因此任何cygwin函数都将失效。如何关闭回音以便输入密码?我基本上通过popen模拟了以下内容: save_state=$(stty -g) /bin/echo -n "Account: " read acct /bin/echo -n "Password: " stty
GetConsoleMode
/SetConsoleMode
失败<代码>\u getch也会回显到控制台。这是一个本机win32应用程序,没有绑定到cygwin环境,因此任何cygwin函数都将失效。如何关闭回音以便输入密码?我基本上通过popen
模拟了以下内容:
save_state=$(stty -g)
/bin/echo -n "Account: "
read acct
/bin/echo -n "Password: "
stty -echo
read password # this won't echo
stty "$save_state"
echo ""
echo account = $acct and password = $password
Read more at http://www.askdavetaylor.com/how_to_read_password_without_echoing_c.html#Z3FtcTtMHe0gJdES.99
保存状态=$(stty-g)
/bin/echo-n“帐户:”
阅读账户
/bin/echo-n“密码:”
stty-echo
读取密码#这不会回显
stty“$save_state”
回声“”
echo帐户=$acct和密码=$password
阅读更多http://www.askdavetaylor.com/how_to_read_password_without_echoing_c.html#Z3FtcTtMHe0gJdES.99
我基本上通过
popen
模拟了以下内容:
save_state=$(stty -g)
/bin/echo -n "Account: "
read acct
/bin/echo -n "Password: "
stty -echo
read password # this won't echo
stty "$save_state"
echo ""
echo account = $acct and password = $password
Read more at http://www.askdavetaylor.com/how_to_read_password_without_echoing_c.html#Z3FtcTtMHe0gJdES.99
保存状态=$(stty-g)
/bin/echo-n“帐户:”
阅读账户
/bin/echo-n“密码:”
stty-echo
读取密码#这不会回显
stty“$save_state”
回声“”
echo帐户=$acct和密码=$password
阅读更多http://www.askdavetaylor.com/how_to_read_password_without_echoing_c.html#Z3FtcTtMHe0gJdES.99