Homework 1a: Unix and Emacs

Due 01/16/05

Educational Objectives: Experience with Unix files, directories, permissions, and symbolic links; experience creating customized Unix commands; experience using Emacs

Operational Objectives:

  1. Install a set of Emacs initialization files
  2. Create a directory for your course files
  3. Create a symbolic link to the course library
  4. Create Unix commands clean, c4530, and co4530

Deliverables: One file hw1a.txt, to be submitted after completing Homework 1b

Procedural Requirements

  1. If you have not obtained a CS account, do so now at http://www.cs.fsu.edu/sysinfo/newstudent.html. Then email lacher from your new account, so that your username can be added to the 4530ps05 group. It may take a day or so for this to be accomplished. You will not be able to complete this assignment until you are in the group. You can check to see if you are in the group by issueing the command:

    ypmatch 4530ps05 group

  2. Log in to your CS account. In your home directory, create a directory named cop4530. From within this directory, create subdirectories named as follows:

    hw1
    hw2
    hw3
    hw4
    proj1
    proj2
    proj3
    proj4
    

    Change permissions for all of the directories to 700 by issuing the command

    chmod 700 *
    

    What does this command do? (Hint: man chmod.)

  3. Create a symbolic link to the course library by issuing the following command:

    ln -s /home/courses/cop4530p/spring05 LIB
    

    This should create a link from "LIB" to the course library files. (Note that you will not have permission to access these files until your CS username had been added to the group 4530ps05.) Now a long listing of your cop4530 directory should produce something like the following:

    drwx------  2 username CS-Course 512 Dec  7 12:54 hw1
    drwx------  2 username CS-Course 512 Dec  7 12:54 hw2
    drwx------  2 username CS-Course 512 Dec  7 12:54 hw3
    drwx------  2 username CS-Course 512 Dec  7 12:54 hw4
    lrwxrwxrwx  1 username CS-Course  31 Dec  7 12:52 LIB -> /home/courses/cop4530p/spring05
    drwx------  2 username CS-Course 512 Dec  7 12:54 proj1
    drwx------  2 username CS-Course 512 Dec  7 12:54 proj2
    drwx------  2 username CS-Course 512 Dec  7 12:54 proj3
    drwx------  2 username CS-Course 512 Dec  7 12:54 proj4
    

    The symbolic link is in effect a short cut over to the course library for use in file manipulation commands, such as cd and cp.

  4. Get back into your home directory (issue the command cd with no argument). Unless you already have a customized setup for emacs, do the following three commands:

    1. cp ~cop4530p/.emacs .
    2. mkdir .lisp
    3. cp ~cop4530p/.lisp/* .lisp/
    These commands create a set of configuration files that are read by Emacs on startup.

  5. Remaining in your home directory, issue the command

    ls -al

    This will show a long (-l) listing (ls) of all (-a) of the contents of the directory, including those items that are normally ignored by the ls command. Get into your directory named .bin. Using emacs, create a file named clean with the following contents:

    #!/bin/sh
    rm $1/*~
    rm $1/*.o
    rm $1/*.x
    

    Then issue the command

    chmod 700 clean

    What you have just accomplished is the creation of a Unix script clean that executes from the command line. This command takes one argument (denoted by $1 in the code) intended to be a directory (or path). Execution of the command will safely remove all of the Emacs backup files (ending in "~"), object code files (ending in ".o"), and executables (which will end in ".x" by convention in this course) from the directory. This is very handy to keep from cluttering your work space.

  6. Copy the following two files from ~/cop4530/LIB/examples/scripts into .bin: c4530 and co4530. (Assuming you are still in the .bin directory, these copies should be created by the following command:

    cp ../cop4530/LIB/examples/scripts/* .
    

    Change the permissions on these files so that they are executable, as described above for your clean command. Also, look at these files using emacs. What does c4530 do? What does co4530 do? (To answer these questions, look at the manual for g++ by entering the command man g++.) Finally, issue the command hash, which will incorporate the three new comamnd into your login session. (This will happen automatically in all new login sessions.)

Technical Requirements and Specifications

  1. This is the documentation phase of the assignment, to be completed inside your subdirectory ~/cop4530/hw1.

  2. Use Emacs to create a text file named hw1a.txt. Type the following information at the top of this file:

    COP 4530 Spring 2005
    Homework Assignment 1
    (Your Name)
    CS  Username: (Your CS Username   - used for login to CS account)
    FSU Username: (Your ACNS Username - used for login to Blackboard)
    

    Save the file and close Emacs. Issue the command

    clean .
    

  3. Open the file hw1a.txt with Emacs in one window, and open a second window to the same directory. In this second window, you will issue commands and copy/paste the resulting screen output into hw1a.txt. Specifically:

    Copy/paste screen output into hw1a.txt that documents each of following commands:

    1. ls -l ~/cop4530
    2. ls -l ~/cop4530/hw1
    3. ls -l ~/.bin
    4. more ~/.bin/c4530
    5. more ~/.bin/co4530
    6. more ~/.bin/clean

    Save and close the file, but do not submit. It will be part of the material submitted after completing part b.