1 !/bin/bash 2 if [ $† -eq 0 ]; then 3 echo "Usage:" echo "$0 userlist" echo "$0 userinfo " 4. 5 6 fi 7. 8 case $1 in 9. 10 11 12 13 14 15 16 17 userlist) grep -v ':/sbin/nologin§' /etc/passwd | cut -d: -fl | sort userinfo) if [ "$2" == "" ]; then echo "Please specify a username" exit 2 fi if ! getent passwd $2 &> /dev/null; then echo "invalid user" 18 19 20 21 22 23 24 25 exit fi getent passwd $2 I cut -d: -f7 *) exit 26 esac

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Detailed answer please. Thank you

2.1 Based on the Bash Script below, i) analyze the code. ii) Identify the objectives
of the system admin?
1 #!/bin/bash
2 if [ $t -eq 0 ]; then
3
echo "Usage:"
echo "$0 userlist"
echo "$0 userinfo <USERNAME>"
6 fi
4
7.
8.
case $1 in
userlist)
10
grep -v ':/sbin/nologin$' /etc/passwd | cut -d: -fl | sort
11
12
userinfo)
if [ "$2"
echo "Please specify a username"
exit 2
"" ]; then
13
14
15
16
17
18
19
20
==
fi
if ! getent passwd $2 &> /dev/null; then
echo "invalid user"
exit
fi
21
getent passwd $2 | cut -d: -f7
22
23
24
exit
26
esac
N222
Transcribed Image Text:2.1 Based on the Bash Script below, i) analyze the code. ii) Identify the objectives of the system admin? 1 #!/bin/bash 2 if [ $t -eq 0 ]; then 3 echo "Usage:" echo "$0 userlist" echo "$0 userinfo <USERNAME>" 6 fi 4 7. 8. case $1 in userlist) 10 grep -v ':/sbin/nologin$' /etc/passwd | cut -d: -fl | sort 11 12 userinfo) if [ "$2" echo "Please specify a username" exit 2 "" ]; then 13 14 15 16 17 18 19 20 == fi if ! getent passwd $2 &> /dev/null; then echo "invalid user" exit fi 21 getent passwd $2 | cut -d: -f7 22 23 24 exit 26 esac N222
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY