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 Bash Shell Lab Exercises

Lab 1—First Script

  1. Write a script called greetme that will:

    1. Contain a comment section with your name, the name of this script, and the purpose of this script.

    2. Greet the user.

    3. Print the date and the time.

    4. Print a calendar for this month.

    5. Print the name of your machine.

    6. Print the name and release of this operating system, (cat /etc/motd).

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

    8. Print all the processes root is running.

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

    10. Print your disk usage (du).

    11. Use the id command to print your group ID.

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

    13. 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 ...

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