Question: Question 0 : Run the create _ a 4 . sh script to generate the starter files. Question 1 : Write a script called, script

Question 0:
Run the create_a4.sh script to generate the starter files.
Question 1:
Write a script called, script4_1.sh that extracts the First Name, Last Name and Adjusted Score columns from files with similar formatting as rand_data.csv, do not assume that you will always be given this particular file as input. Sort the data numerically by Adjusted Score and print the top n scores, where is n is specified on the command line as $2 and the filename of the data file is $1.
The invocation of your script may look like the following:
./script4_1.sh rand_data.csv 3
Where for the above example, the top 3 scores are printed.
First Name,Last Name,Adjusted Score
YoYo,Rubics,90.21
Mariko,Sama,73.92
Nakajima,Rocky,71.38
Question 2:
You suspect a file has been modified, this file is called suspect.txt. You do not have a copy of original file, but you do have the file processed.txt, which was generated from the original unmodified file using a bash filters.
Write a script called script4_2.sh that has the inputs:
$1, the suspect file
$2, the processed file
You may only use the commands you've learned in class so far to solve this problem, so tools like grep, awk, sed cannot be used.
Your script will list the Student numbers that has modified letter grades. Only list each student number once to stdout.
An example invocation would be:
./script4_2.sh suspect.txt processed.txt
May have the output:
2367
2126
1111
The order of the student numbers do not matter.
Click here for a hint on how to compare files
Alternative hint
Question 3
Write a command called script4_3.sh that takes in 1 parameter $1, which represent the the parent ID. For the parent ID list all the process IDs of its children, and their invocation including the parameters to stdout. Kill all the child process of that parent, without killing the parent.
Example invocation:
./script4_3.sh 19155
May produce the following output:
19164,bash /tmp/test_script_1280.sh 10
19165,bash /tmp/test_script_1280.sh 21
19166,bash /tmp/test_script_1280.sh 22
19167,sleep 5h
It is a comma separated table, that list all the immediate child processes of the parent process. The 1st column represents process id of the child, and the second column represents the invocation used to create the child. This information can be found using the -f option of the ps command. Remember that you script should attempt to kill all the processes listed.
A script called start_process_tree.sh has been provided for you to test your script. It will create 4 background processes, sometimes you may not see the sleep 5h process but that is okay.
You can invoke the script by using:
./start_process_tree.sh &
to have the script running the in the background, the process ID will be printed after you invoke the script in the background.
./start_process_tree.sh &
[2]19155
Note that when you run the script, sometimes you may see the extra output like following:
./start_process_tree.sh: line 25: 21241 Terminated bash /tmp/test_script_1280.sh 10
./start_process_tree.sh: line 25: 21242 Terminated bash /tmp/test_script_1280.sh 21
./start_process_tree.sh: line 25: 21243 Terminated bash /tmp/test_script_1280.sh 22
./start_process_tree.sh: line 25: 21244 Terminated sleep 5h
21241,bash /tmp/test_script_1280.sh 10
21242,bash /tmp/test_script_1280.sh 21
21243,bash /tmp/test_script_1280.sh 22
21244,sleep 5h
The termination messages are emitted from the stderr of the ./start_process_tree.sh and not your script so you don't have to worry about them. These messages occur when the child processes are killed.

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!