O'Reilly logo

Linux Shells by Example by Ellie Quigley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The TC Shell Lab Exercises

Lab 1—First Script

  1. Write a script called greetme that will:

    1. Greet the user.

    2. Print the date and time.

    3. Print a calendar for this month.

    4. Print the name of your machine.

    5. Print a list of all files in your parent directory.

    6. Print all the processes you are running.

    7. Print the value of the TERM, PATH, and HOME variables.

    8. Print " Please couldn't you loan me $50.00? "

    9. Tell the user " Good bye " and the current hour. (See man pages for the date command.)

  2. Make sure your script is executable.

    chmod +x greetme
    
  3. What was the first line of your script?

Lab 2—Getting User Input

  1. Write a script called nosy that will:

    1. Ask the user's full name—first, last, and middle name.

    2. Greet the user by his or her first name.

    3. Ask the user's year of birth and calculate ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required