【一练】判断输入用户是否存在/etc/passwd

上一篇 / 下一篇  2017-10-20 16:08:26 / 个人分类:shell

#!/bin/bash

line1=`grep $1 /etc/passwd`
line2=${line1%%:*}

if test "$line2" != $1  
then
    echo "the user $1 is not  in the passwd";
else 
    echo "the user $1 is in the passwd";
fi 


TAG:

 

评分:0

我来说两句

Open Toolbar