Homework 2: vi

(5 Points)

You will have to do this homework on the 316 Hammond Workstations. Login to one of the machines using your Access ID and password. If you are sitting at the workstation rather than using a remote login, wait for the XWindows session to begin. A direct workstation session will give you two windows in which you can type commands. Click one window with the mouse. to permit typing. If you are on a remote login, just continue typing as instructed after you see a prompt from the machine.

Before doing anything else, begin by typing the following command after the prompt in the window:


Be sure to start the command with the "tilde" character. This line tells the computer to execute the commands contained in the file "setup" located in a subdirectory called "201" under my home directory (~jhm is an abbreviation to quickly point at my home directory).

My program called "setup" will create a subdirectory for you containing the file "tutor.vi", and set the necessary access rights for us to collect and grade your homework.

Next type:

cd homework

vi tutor.vi

Follow the instructions built into the file, making all corrections requested. If you are not happy with the results, obtain a new copy of the file and try again. Do nothing to change the access privileges on the file. We will retrieve it from your directory for grading on Thursday morning.

If you need a clean copy of "tutor.vi, you can obtain it in one of two ways. The simplest is to click on the link to the file earlier in this write-up, and then use the Save option in the File menu of Netscape to save a copy of the file in your subdirectory "homework". The other is to type the command:

cp ~jhm/201/tutor.vi ~/homework

A "~" alone is an abbreviation for your home directory, so this copy command takes "tutor.vi" from my "201"subdirectory and puts a copy in your subdirectory called "homework".

Note: You may have problems getting vi to display the file properly. If you don't see something that obviously looks like the beginning of the tutorial, or strange things happen when you scroll, exit from vi by typing ":q!"(quit vi without saving any changes). If you are working directly at the workstation type the command "resize", then repeat the command "vi tutor.vi". If you are logged in remotely using a terminal emmulator type "set term=vt100" (be careful not to put spaces before or after the "="), then repeat the vi command.