In a UNIX terminal create a shell script that will accomplis
In a UNIX terminal create a shell script that will accomplish the following: Use variables and comments for your script. Find all processes that are owned by your ID, Write the resulting out to a text file called: yourName-assignment3-1.txt, Find all processes that are owned by your ID except for those that were initiated by the calling program. You will need a combination of the grep command, Write the resulting out to a text file called: yourName-assignment3-2.txt Create a new program that does the following: Accepts the arguments of the 2 new text files, Creates a new file with the combined files, Create a new tar file that has all 3 files
Solution
1. To view only the processes owned by a specific user, Replace the [username] with the required username
 \'ps\' displays information about a selection of the active processes.
 2. \'-u\' userlist Select by effective user ID (EUID) or name.This selects the processes whose effective user name or ID is in userlist. The effective user ID describes the user whose file access permissions are used by the process (see geteuid(2)). Identical to U and --user.
 Here in the second program \'-w\' gives exact string matching results and \'-v\' gives the output excluding the grep results. Here we are excluding \'ps\' and \'grep\' as they are the calling programs
 3. Third program creates the tar of the given 3 files
 
 ps -u [username] > yourName-assignment3-1.txt
ps -u [username] | grep -wv \'ps\' | grep -wv \'grep\' > yourName-assignment3-2.txt
 #!/bin/bash
 >> yourName-assignment3-3.txt
 cat $1 >> yourName-assignment3-3.txt
 cat $2 >> yourName-assignment3-3.txt
tar cf tar_Of_given_three_Files.tar yourName-assignment3-1.txt yourName-assignment3-2.txt yourName-assignment3-3.txt

