I need to write a script that prompts the user to enter a username and then if that username exists, lists all of the user's information from the password file and a list of all commands they are currently running. So far I have this:
#!/bin/bash
echo "Please enter username"
read username
if [ "$username" = cat /etc/passwd | cut -d: -f1 ]
then
//list all user info from passwd file
id $username
//list all commands they are running
i dont know how to code this
fi
If you guys can help me fill in or change anything that will be great, thanks!