脚本名称:test4.txt
cd/opt mkdirshell ls vitest4.txt
脚本内容如下:
#!/bin/bash [!$#-eq1]&&echo"Argsiserror"&&exit5 id$1&>/dev/null&&echo"User$1exist"&&exit2 id$1&>/dev/null||useradd$1 id$1&>/dev/null&&echo"$1"|passwd--stdin$1&>/dev/null&&echo"AddUser $1Success." COUNT=`wc-l/etc/passwd|awk'{print$1}'` echo"TotalUsersis$COUNT"原文链接:https://www.f2er.com/bash/392370.html