Stty [ -A] [- G ] [ Options ] Stty (set TTY) commands are used to display and modify the properties of the currently registered terminal.
The UNIX system provides an important means of controlling the input and terminal output of the keyboard, which can be set by the Stty command for a specific terminal or communication line. This option is cleared when the corresponding option in Stty is preceded by a minus sign (-), which is set if no minus sign is selected.
Stty-a #将所有选项设置的当前状态写到标准输出中
old_stty_settings= ' Stty-g ' #保存当前设置
Stty "$old _stty_settings" #恢复当前设置
Stty-echo #禁止回显, does not appear on the screen when you enter it on the keyboard
Stty Echo #打开回显
Stty Raw #设置原始输入
Stty-raw #关闭原始输入
Stty IGNCR #开启忽略回车符
stty-igncr# closing the Ignore carriage return character
Example one:
[Python]View Plaincopy
- #!/bin/sh
- Stty-echo
- Echo-n "Please set your password:"
- Read P
- Stty Echo
- ECHO-E "\nyour password is: $p"
Example two:
Stty-ctlecho (equivalent to "-echoctl")
[Email protected] ~]# Stty-ctlecho
[[email protected] ~]# launch
-bash: Start: Command not found
[[Email protected] ~]# boot (ctrl + C key)
[[email protected] ~]# hahaha (CTRL + C key)
[[Email protected] ~]# I don't export (Ctrl + C key)
[[email protected] ~]# echo "SDFD" (Enter)
Sdfd
[Email protected] ~]# stty ctlecho
[Email protected] ~]# okay ^c
The Stty command uses