Question: Need help to solve these two question please and i am getting an error. Please i need step by step solution. (UNIX) Here is the

Need help to solve these two question please and i am getting an error. Please i need step by step solution. (UNIX)

Need help to solve these two question please and i am getting

Here is the code that i type:

38.

#!/bin/bash myvar=$1

pid_print=`ps -ef | grep "echomyvar.sh" | head -1 | cut -d' ' -f8` echo "Value of myvar is : $myvar" echo "PID of script running is : $pid_print"

but in the output i get only value of myvar but i am not getting the PID .

39.

grep -wi "Connect" messages.out | awk 'NF>1{print $NF}' | grep -v "try" | wc -l

but i am getting 0 as output and it has to be 2 so something is wrong with this code please help me to solve it.

38. Write and run a simple shell script named echomyvar.sh that displays the PID of the process running the script and value of the variable named myvar but do not set the variable value within the script. Set the value of the variable myvar to "zach" from the command line (not in the script) using "declare" Run the script, does it show both the pid and the proper value of myvar? 39.Write a regular expression to grep the messages.out Match al lines that have the word "Connect" in it but not any other series of letters that include Connect. For instance, do not match "Connects". Also, do not match any of these lines that "end" with the word try". Pipe this to a command to count the amount of matched lines. The result should be "2

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 Databases Questions!