linux-tutorial/codes/shell/输入和输出/隐藏方式读取数据.sh

10 lines
222 B
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/usr/bin/env bash
# hiding input data from monitor
read -s -p "Please enter your password: " pass
#添加了-s选项之后不会自动换行不添加-s 会自动换行
echo
echo "Is your password really $pass?"