Changes

Jump to: navigation, search

OPS235 Scripting Exercises

464 bytes added, 10:27, 16 January 2020
Exercises
* Write a bash script that will ask the user for a process name, will check whether that process is running, and if it is: it will print "The process is running". If it isn't: it will print "The process is not running".
** Modify that script to include the number of processes with that name that are running.
* Write a script that will use a for loop and the cut command to get a list of usernames from the /etc/passwd file and print one username perline.
** For each user: using an if statement check whether the directory /home/thatusername exists and then each line will look like: "user1: home directory does not exist" or "user2: home directory exists".
** Instead of checking for /home/thatusername check for the home directory in the passwd file line for that user.

Navigation menu