linux判断用户是否存在的方法:1、将“read -p "please input a username:" username...”保存为test.sh;2、运行“sh test.sh”即可。本文操作环境:linux5.9.8系统,Dell G3电脑
linux判断用户是否存在的方法:1、将“read -p "please input a username:" username...”保存为test.sh;2、运行“sh test.sh”即可。
本文操作环境:linux5.9.8系统,Dell G3电脑。
linux怎么判断用户是否存在?
linux 判断一个用户是否存在:
#!/bin/bashread -p "please input a username:" usernameif id -u $username >/dev/null 2>&1; then echo "user exists"else echo "user does not exist"fi把上面内存保存为 test.sh , 然后 sh test.sh 运行
推荐学习:《linux视频教程》
免责声明:本文内容由互联网用户自发贡献自行上传,本网站不拥有所有权,也不承认相关法律责任。如果您发现本社区中有涉嫌抄袭的内容,请发送邮件至:operations@xinnet.com进行举报,并提供相关证据,一经查实,本站将立刻删除涉嫌侵权内容。