姬長信(Redy)

linux – 在shell脚本中使用passwd命令


我正在编写一个shell脚本来自动添加新用户并更新他们的密码.我不知道如何让passwd从shell脚本中读取而不是以交互方式提示我输入新密码.我的代码如下.
adduser $1
passwd $1
$2
$2