want to test the running script pause function
copied an online script
https://www.cnblogs.com/zqb-a.
-sharp!/bin/bash
-sharp!/bin/stty
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
-sharptest
function get_char()
{
SAVEDSTTY="stty -g"
stty -echo
stty cbreak
dd if=/dev/tty bs=1 count=1 2> /dev/null
stty -raw
stty echo
stty $SAVEDSTTY
}
echo "1"
echo "2"
get_char
echo "3"
the result of the run is like this, and Baidu can"t get the answer if you don"t understand it.
1
2
test1.sh: line 10: SAVEDSTTY=stty-g: command not found
test1.sh: line 11: stty: command not found
test1.sh: line 12: stty: command not found
test1.sh: line 14: stty: command not found
test1.sh: line 15: stty: command not found
test1.sh: line 16: stty: command not found
3
Thank you, God.