linux命令行隐藏input输入
2018-03-26 10:44
1116 查看
脚本如下:
function hidden_input { typeset function_name="hidden_input" typeset prompt="$1" typeset input="" typeset character="" echo "" echo "$prompt:" STTY_RESTORE=$(stty -g) stty -echo cbreak while true do character=$(dd if=/dev/tty bs=1 count=1 2> /dev/null) case $character in $(printf "\n")) printf "\n" break ;; $(printf "\b")) if [ -n "$input" ]; then printf "\b \b" input=$(echo "$input" | sed 's/.$//g') fi ;; *) input=$input$character printf '*' ;;esac done stty $STTY_RESTORE RETURN[0]="${input}" } hidden_input "Input the password" password="${RETURN[0]}" echo $password
Input the password: ******* #输入密码:1234567
相关文章推荐
- linux input输入子系统分析《四》:input子系统整体流程全面分析
- [input] linux输入子系统(一)
- linux input输入子系统分析《二》:s3c2440的ADC简单驱动实例分析
- Linux/Android——输入子系统input_event传递 (二)
- Linux 标准输入struct input_event使用示例
- linux下隐藏输入密码
- linux驱动—input输入子系统—The simplest example(一个最简单的实例)分析(1)
- linux 读取input输入设备demo
- Linux命令行与shell脚本(10)--获得用户输入
- HTMLInputHidden 隐藏输入控件
- Linux输入子系统:input.txt
- input标签禁止输入隐藏光标
- 如何隐藏你的Linux的命令行历史
- Linux 输入(input)子系统架构分析
- 修改或隐藏Linux终端命令行中的用户名和主机名
- Linux输入子系统:输入设备编程指南 -- input-programming.txt .
- 如何隐藏你的 Linux 的命令行历史
- 如何隐藏你的 Linux 的命令行历史
- linux 输入子系统(4)---- input子系统的初始化
- linux input输入子系统的使用