相关疑难解决方法(0)

在符合 POSIX 的 shell 中询问密码?

当我想在bash脚本中要求输入密码时,我会这样做:

read -s
Run Code Online (Sandbox Code Playgroud)

...但是当我bash在 POSIX 模式下运行时sh,该-s选项被拒绝:

$ read -s
sh: 1: read: Illegal option -s
Run Code Online (Sandbox Code Playgroud)

如何使用符合 POSIX 的命令安全地请求输入?

shell scripting password posix

19
推荐指数
2
解决办法
3054
查看次数

标签 统计

password ×1

posix ×1

scripting ×1

shell ×1