Question: Question 0 : Run the create _ a 4 . sh script to generate the starter files. Question 1 : Write a script called, script
Question :
Run the createash script to generate the starter files.
Question :
Write a script called, scriptsh that extracts the First Name, Last Name and Adjusted Score columns from files with similar formatting as randdata.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 $ and the filename of the data file is $
The invocation of your script may look like the following:
scriptsh randdata.csv
Where for the above example, the top scores are printed.
First Name,Last Name,Adjusted Score
YoYo,Rubics,
Mariko,Sama,
Nakajima,Rocky,
Question :
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 scriptsh that has the inputs:
$ the suspect file
$ 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:
scriptsh suspect.txt processed.txt
May have the output:
The order of the student numbers do not matter.
Click here for a hint on how to compare files
Alternative hint
Question
Write a command called scriptsh that takes in parameter $ 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:
scriptsh
May produce the following output:
bash tmptestscriptsh
bash tmptestscriptsh
bash tmptestscriptsh
sleep h
It is a comma separated table, that list all the immediate child processes of the parent process. The st 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 startprocesstree.sh has been provided for you to test your script. It will create background processes, sometimes you may not see the sleep h process but that is okay.
You can invoke the script by using:
startprocesstree.sh &
to have the script running the in the background, the process ID will be printed after you invoke the script in the background.
startprocesstree.sh &
Note that when you run the script, sometimes you may see the extra output like following:
startprocesstree.sh: line : Terminated bash tmptestscriptsh
startprocesstree.sh: line : Terminated bash tmptestscriptsh
startprocesstree.sh: line : Terminated bash tmptestscriptsh
startprocesstree.sh: line : Terminated sleep h
bash tmptestscriptsh
bash tmptestscriptsh
bash tmptestscriptsh
sleep h
The termination messages are emitted from the stderr of the startprocesstree.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
