Question: Using Ubuntu OS , write and implement ONE ( 1 ) bash shell script. Manually copy the / etc / passwd file into the same
Using Ubuntu OS write and implement ONE bash shell script. Manually copy the etcpasswd file into the same folder as your script and use the root account to execute the script. The script needs to execute on the passwd file that have been copied to the folder, and NOT on the original etcpasswd file. That means some commands cannot be used in your script, such as id getent, pwck useradd, etc. The script will be executed with no arguments, and it can be executed in any folder. However, you can assume that your script will not be executed in the etc folder.
The script will prompt the user to enter a filename of a file in the current folder the file format is the same as etcpasswd file
o It will check whether the file exists in the current folder, if the file does not exist, it will prompt the user to enter the filename again.
o It will keep asking the user to enter the filename again until the user enter a filename of a file that exist in the current folder.
o If the file exists in the current folder, it will proceed to check the content of the file and display ONLY the following information on the screen:
number of user accounts you are to assume that the user account is having a shell of binbash or binsh
username of the user accounts
the smallest user id UID among all the user accounts
o The script will then display the following information according to the file size.
If the file size is less than bytes, change the permission of the file to owner can read, write and execute, group can read and write, and others dont have permission.
If the file size is equal or more than bytes, display the number of days elapsed since January
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
