Basic Bashing Unix Lab

Your name here (please print):

EACH STUDENT SUBMITS ONE FILE WITH ANSWERS TO SCHOLAR

  1. (5 points) Understand what the command expr does. Then write a bash script called interactive-product to read in two numbers, one at a time, and then print their product. If you found an alternative to using "expr", it is fine.

    This script should work as follows:

    [user@host name]$ ./interactive-product
    Please enter the first number:
    3
    Please enter the second number:
    7
    The product is 21.

    Write your script below.

     

     

  2. (5 points) Make three files in your home directory: John.1, John.2 and John.3. Use "vim" to put the name John Donn in the first one, John Smith in the second and Mary Ann in the third. Now write a bash script that searches for "John" in files John.k, where k goes from 1 to 5. Write it below. You will find "grep" function useful.

     

     

  3. (5 points) Modify the "stock quote" bash script from your lecture to print the output lines in bold white font on green background. You will find the rainbow.sh from these examples useful. Write the appropriate echo command below.