#1. Write a Bourne Again Shell script (name it \"user1.sh\") to do the following
ID: 3853838 • Letter: #
Question
#1. Write a Bourne Again Shell script (name it "user1.sh") to do the following task:
(1) prompts you for a user ID, (2) then read passwd1.txt file in the present working directory (as shown below) and then (3) displays login name, user’s name, uid and gid, pathname for user’s home directory, and user's default shell.
Note. This example shows the user (rkm010300) for Dr. Min. You should insert your record in this passwd1.txt file to include one line for your userid (netid), userid=2000, gid=514, comment with your name and UTD email (NetID), your home directory, and your default shell.
$ cat passwd1.txt
SYSTEM:*:18:544:,S-1-5-18::
LocalService:*:19:544:U-NT AUTHORITYLocalService,S-1-5-19::
NetworkService:*:20:544:U-NT AUTHORITYNetworkService,S-1-5-20::
Administrators:*:544:544:S-1-5-32-544::
Administrator:*:500:513:U-richard-PCAdmin:/home/Administrator:/bin/bash
Guest:*:501:513:U-richard-PCGuest:/home/Guest:/bin/bash
rkm010300:*:1000:513:Richard Min – email - rkm010300:/home/rkm010300:/bin/bash
john:*:1010:600:John-Staff:/home/john:/bin/sh
$ ./user1.sh rkm010300
userid: rkm010300
uid: 1000
gid: 513
home directory: /home/rkm010300
shell:/bin/bash
Answer (copy and paste your anwer here) and mark it yellow (for background color).
#!/bin/sh
echo -n "Enter user-name: "
exit 0
Explanation / Answer
#!/bin/bash
read -p "Enter Your user ID: " userid
find . -name passwd1.txt
cat passwd1.txt
id $userid
***Please provide the CF score by liking the answer. Thanks in advance.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.