4.4 Exercises

4.4.1 Variable declaration

See Section 12.0.4 for solutions.

  1. Declare two variables aand b and set them to 5 and 18, respectively. Then use bc to calculate their product.

  2. Declare a variable course that contains “Introduction to UNIX” and another variable chapter that contains “Chapter 4”. Using the defined variables, print to the screen the following message: “Introduction to UNIX: Chapter 4!”

  3. Declare a variable messageand set it to 42. Then declare a variable file and set it to answer.txt. Print message to file.

  4. Declare an additional variable truth that should contain the content of message. Then change message to hold 43 and use these variables to print “The truth is truth not message