Question

Write a linux bash script that enables user to create his resume make sure that the...

Write a linux bash script that enables user to create his resume make sure that the assigned value doesn't change.

Homework Answers

Answer #1

#!/bin/sh
trap trapInt INT

trapInt(){
echo 'Paused. Enter q to quit, something else to resume.'
read reply
[ "$reply" = "q" ] && exit
}

i=$$
while :; do
sleep 1
echo $$,$i
i=$((i+1))
done

The main block of the script is just a infinite loop, composed of a 1 second sleep, an echo of the PID of the shell ($$) and an incrementing number ($i).

Upon receiving the INT signal, the running command is interrupted and the function trapInt is executed.

$ ./v.sh
11136,11136
11136,11137
11136,11138
^CPaused. Enter q to quit, something else to resume.
  <-- typed <Enter>
11136,11139
11136,11140
11136,11141
^CPaused. Enter q to quit, something else to resume.
q <-- typed <q><Enter>
$ 
Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is for my linux class. Write a script called activity4.2-3 that modifies your activity4.2-2 script...
This is for my linux class. Write a script called activity4.2-3 that modifies your activity4.2-2 script to also display a message when the user provided is not logged on. An example is shown below. Purpose: Determine if someone is logged on bash-3.2$ ./activity4.2-3 nonuser nonuser is either not logged on or not a valid user Include a first line that calls the bash shell as the interpreter Add a comment to state the purpose of the script and other comments...
Create a bash script that takes numbers as parameters, calculates sum and prints the result. If...
Create a bash script that takes numbers as parameters, calculates sum and prints the result. If no parameters passed, prompt a user (only one time) to enter numbers to sum and print the result.
Create a bash script that takes numbers as parameters, calculates sum and prints the result. If...
Create a bash script that takes numbers as parameters, calculates sum and prints the result. If no parameters passed, prompt a user (only one time) to enter numbers to sum and print the result.
Linux 2)   Write a bash script which when executed, expects two integers, say n1 and n2....
Linux 2)   Write a bash script which when executed, expects two integers, say n1 and n2. If the first argument, n1, is greater than the second argument, n2, the script calls a function (written within the script) and passes to the function n1 and n2 to compute the sum from n1 to n2. This function returns the sum which the script prints. If n1 is not greater than n2, the script calls the same function and passes the n1 and...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items...
Name the script for.sh.  This script will create a shopping list. Ask the user to enter items separated by a space. Read the list. Use a for loop to write (use echo) the items to a file called shopping_list. You should use >> to append the output to the file, so each time the script is run the list should get longer. After the for loop finishes, display (use cat) the contents of the shopping list with 1 item per line....
In UNIX .Write a bash script that takes a list of usernames as its command line...
In UNIX .Write a bash script that takes a list of usernames as its command line arguments and displays on the screen, for each user name, a message of the form Number of times that logged into this machine is where is to be replaced by the number of recors that the last command output that match exactly. For example, if i enter command logincount mark it should output something like number of times that sweiss logged into this machin...
Write a script that plays a simple “guess the number” game with the user. It should...
Write a script that plays a simple “guess the number” game with the user. It should select a random integer in the range [0 - 10], ask the user to guess the value, and provide feedback of the form “too high”, “too low”, or “congratulations” as appropriate. After the correct value is guessed, the script should terminate.
This program is in C++: Write a program to allow the user to: 1. Create two...
This program is in C++: Write a program to allow the user to: 1. Create two classes. Employee and Departments. The Department class will have: DepartmentID, Departmentname, DepartmentHeadName. The Employee class will have employeeID, emploeename, employeesalary, employeeage, employeeDepartmentID. Both of the above classes should have appropriate constructors, accessor methods. 2. Create two arrays . One for Employee with the size 5 and another one for Department with the size 3. Your program should display a menu for the user to...
Create a Health Brochure that relates to an environmental health issue. Make sure to write the...
Create a Health Brochure that relates to an environmental health issue. Make sure to write the information so that it is accessible to your target audience. In other words, if you are targeting parents, you might write differently than you would when submitting information to a peer-reviewed journal. Visit www.cdc.gov for ideas on topics. In the brochure, including the following: At least seven facts relating to the health issue chosen. Include who is most at risk and prevention strategies.
Write a Java program to randomly create an array of 50 double values. Prompt the user...
Write a Java program to randomly create an array of 50 double values. Prompt the user to enter an index and prints the corresponding array value. Include exception handling that prevents the program from terminating if an out of range index is entered by the user. (HINT: The exception thrown will be ArrayIndexOutOfBounds)