Modify relevant settings of the terminal command line
stty command Modify the relevant settings of the terminal command line.
stty(option)(parameter)-a: Print all current configurations in an easy-to-read format;
-g: Print all current configurations in a stty-readable format.Terminal settings: Specify terminal command line setting options.
On the command line, how to disable uppercase output:
stty iuclc #Open
stty -iuclc #restoreDisable lowercase output on the command line:
stty olcuc #Open
stty -olcuc #restorePrint out the number of rows and columns of the terminal:
stty sizeHow to change Ctrl+D:
stty eof "string"The system default is Ctrl+D to indicate the end of the file, but through this method, it can be changed!
Display blocked:
stty -echo #Disable echo
stty echo #turn on echoTest Methods:
stty -echo;read;stty echo;readIgnore carriage returns:
stty igncr #Open
stty -igncr #restoreTiming input:
timeout_read()
{
timeout=$1
old_stty_settings=`stty -g` #save current settings
stty -icanon min 0 time 100 #set 10seconds,not 100seconds
eval read varname #=read $varname
stty "$old_stty_settings" #recover settings
}An easier way is to use the -t option of the read command:
read -t 10 varname