Shell脚本示例:
#!/bin/bash
# 输入要修改密码的账号
echo "请输入要修改密码的账号:"
read user
# 输入新密码
echo "请输入新密码:"
read -s password # 加上-s可以隐藏输入的密码
# 修改密码
echo "$user:$password" | chpasswd
echo "密码已修改成功!"
分类:Shell
标签:
#!/bin/bash
# 输入要修改密码的账号
echo "请输入要修改密码的账号:"
read user
# 输入新密码
echo "请输入新密码:"
read -s password # 加上-s可以隐藏输入的密码
# 修改密码
echo "$user:$password" | chpasswd
echo "密码已修改成功!"
评论已关闭!