#!/bin/bash#function adduser {if [ $# -lt 1 ]; thenreturn 2# 2: no argumentsfiif id $1 &> /dev/null; thenecho "$1 exists."return 1elseuseradd $1[ $? -eq 0 ] && echo "Add $1 finished." && return 0fi}for i in {1..10}; doadduser myuser$idone
#!/bin/bash#function adduser {if [ $# -lt 1 ]; thenreturn 2# 2: no argumentsfiif id $1 &> /dev/null; thenecho "$1 exists."return 1elseuseradd $1[ $? -eq 0 ] && echo "Add $1 finished." && return 0fi}for i in {1..10}; doadduser myuser$idone
原文:http://www1707.blog.51cto.com/1184226/1735146