IT 244: Introduction to Linux/Unix
Homework 9


Due Sunday, November 12th 11:59 PM

All this work should be done on users3.cs.umb.edu

Deliverables

  1. Modifications to .bash_profile in your home directory.
    30 points

  2. A file named hw9.sh that contains the commands you would type at the command line to achieve each of the steps listed below.
    This file should be in an hw9 directory inside your hw directory inside your it244 directory.
    You must make your script executable. 70 points

Requirements

Testing

Details

Modifications to your startup files

  1. Go to your home directory and edit .bash_profile to define the global variable glenn whose value is the absolute pathname of my home directory.
  2. Again in .bash_profile define an alias gh which will take you to my home directory using the variable defined above.
  3. Also in .bash_profile define a function go_show, that will
    The directory this function takes you to will be specified as an argument to the function on the command line. You will need to use a positional parameter to do this.

Steps for Script

  1. Print to the terminal the value of the variable glenn.
  2. Using a pipeline, grep and a command that will show all your global variables, print to the screen the full definition of the variable glenn. Do not use echo to do this. The command to show all global variables was mentioned in the first class were global variables were discussed.
  3. Aliases and functions are not global, so they cannot normally be run inside a shell script.
  4. Go to your home directory.
    Use the function go_show to move to my home directory using the global variable glenn.
  5. Run a command that will show all the aliases you have currently defined.
  6. Run a command that will show the last 20 commands in your history list.
  7. Create the variable glenn_home whose value is the following
    The home directory of my instructor is /home/ghoffman
    When you define this variable, it must use the value of the variable glenn.
    Now print the value of glenn_home to the terminal.