歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> SHELL編程

查看本地用戶shell

查看本地用戶shell   1 #!/bin/bash 2 #用途:  www.2cto.com   3查看本地用戶shell 4 line=`cat /etc/passwd|grep $1` 5 if [ $? -eq 0 ];then 6 echo user:$1 7 else 8 echo "Not user " 9 exit 0 10 fi 11 oldIFS=$IFS; 12 IFS=":" 13 count=0 14 for item in $line; 15 do 16 [ $count -eq 0 ] && user=$item; 17 [ $count -eq 6 ] && shell=$item; 18 let count++ 19 done; 20 IFS=$oldIFS 21 echo $1\`s shell is $shell;
 
Copyright © Linux教程網 All Rights Reserved