Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a4c06e5

Browse files
author
Ankam Ravi Kumar
authored
Create userexists.sh
1 parent 58c5c91 commit a4c06e5

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

userexists.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
##Purpose: Check given user Exits Or Not
3+
##Date: 27th Oct 2016
4+
##Author: Ankam Ravi Kumar
5+
##WebSite: https://arkit.co.in
6+
7+
##Start
8+
echo "Please Enter User name you want check:\c"
9+
read user
10+
grep $user /etc/passwd > /dev/null
11+
if [ $? -eq 0 ]; then
12+
grep $user /etc/passwd
13+
echo "$user Exists in this Machine"
14+
else
15+
echo "$user does not exists"
16+
fi
17+
18+
##END

0 commit comments

Comments
 (0)