View local user shell

Source: Internet
Author: User
View local user shell1 #! /Bin/bash2 # Purpose: www.2cto. com3 view local user shell4line 'cat/etc/passwd | grep $1 '5if [$? -Eq0]; then6echouser: $ 17else8echo & quot; Notuser & quot; 9exit010... view local user shell 1 #! /Bin/bash2 # Purpose: www.2cto.com 3 check local user shell4 line = 'cat/etc/passwd | grep $1 '5 if [$? -Eq 0]; then6 echo user: $17 else8 echo "Not user" 9 exit 010 fi11 oldIFS = $ IFS; 12 IFS = ": "13 count = 014 for item in $ line; 15 do16 [$ count-eq 0] & user = $ item; 17 [$ count-eq 6] & shell = $ item; 18 let count ++ 19 done; 20 IFS = $ oldIFS21 echo $1 \'s shell is $ shell;
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.