Without going around the circle, the answer is revealed: Set the terminal status to "characters do not echo" (if you have known termios, you must have heard of it)
The method is:
stty -echo #Set the input characters not echo
# Here, use the read statement to receive the content input by the user
stty echo #Cancel not echo status
ps: Thank you for the good advice from symclark! His suggestion is to use the -s option of read to directly implement the input content without echoing it, and it does not have to be as troublesome as I wrote in my article. :)
The method is:
stty -echo #Set the input characters not echo
# Here, use the read statement to receive the content input by the user
stty echo #Cancel not echo status
ps: Thank you for the good advice from symclark! His suggestion is to use the -s option of read to directly implement the input content without echoing it, and it does not have to be as troublesome as I wrote in my article. :)