Question: Name the script isloggedon.sh The script should take 1 command line argument, which should be a username. This means you should run the command like

Name the script isloggedon.sh
The script should take 1 command line argument, which should be a username. This means you should run the command like this:./isloggedon.sh usernameand your script will be able to get the username from the command line argument. You should NOT prompt the user to enter username after the script is running.
The script will check to see if the user exists on the system (grep user /etc/passwd).If the user does not exist it will print a message indicating that the user does not exist. Make sure you only get the line for the full username. For example, if the username is rbe0000, you should not also get the rbe0000_t1 account.(If you need help with this, ask)
If the user does exist you will check to see if the user is currently logged on (thewhocommand can be used to see who is currently logged on ( who | grep user)).If the user is logged on print a message that the user is logged on.
If the user is not logged on, use thelastlogcommand to find out the last time the user logged on.Print the username and the date and time of the last login.If the user never logged on, print that the user never logged on.
Put comments in your script to include the script name, author, date created, and purpose.
Test and debug your script. Some test cases:
logged on user - your user accountnot logged on user - rbe1111(if you are running the script on cntserv) sec_team (if you are running the script on your server). It is possible that I might be logged on while you are testing, but that is pretty unlikely unless you have asked me for helpuser that has never logged on - binuser that does not exist - blah
Once your script is complete create a directory in the /home/exercises/abc1234/ directory called module10 on cntserv.(Use your username for abc1234).
Copyyour script into the /home/exercises/abc1234/module10 directory on cntserv.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!