1. (3pts) Given the following directory listing:

dharter@chaos:web$ ls -al

total 440

drwxr-xr-x 7 dharter dharter 4096 2007-02-07 11:32 .

drwxr-xr-x 5 dharter dharter 4096 2007-03-13 10:50 ..

-rwxr-xr-- 1 dharter hpotter 8152 2007-02-03 15:20 script.py

Who has permission to modify the script.py file? ____________________________

Who has permission to view the contents of the file? ____________________________

Who has permission to execute the file? ____________________________


  1. (5pts) Match the following tools/commands with the description of their purpose (you can draw lines and/or match the number with the letter).


1) svn

a) list directory contents


2) chmod

b) change file access permissions


3) gdb

c) read online reference manuals


4) grep

d) task automation and system build tool


5) ls

e) print line matching a regular expression pattern


6) rm

f) c source code compiler


7) man

g) version control


8) cd

h) remove files or directories


9) make

i) symbolic debugger


10) gcc

j) change working directory



  1. (3pts) Mark the following as examples of either Relative path names (R) or Absolute path names (A)


  1. test.py __________

  2. ../../bin/script.py __________

  3. /usr/local/lib/libabs.a __________

  4. ~/work/project/file.txt __________

  5. / __________

  6. ./dat2csv.py __________


  1. (6pts) Several things need to be done in Unix for a script to become executable by the shell program. For example, one bash idiom is to specify the interpreter for a script as the first line using the “#!/usr/bin/env python” as the first line for a python script.


a) What command do you need to run in order to specify that a file is executable to the file system the shell. Be specific, for example set the script called script.py to be executable by the owner, group and everyone else:

$ ls -al script.py

-rw-r--r-- 1 dharter dharter 73 2007-03-13 10:54 script.py

$



b) If you want to execute your script from the command line like you would a built in command (say ls or cd), you need to make sure the executable can be found by the shell. How would you add the location of a script so it can be found and executed by the shell. Again be specific and add your current working directory so that all scripts in your current directory can be found and executed:


$


  1. (2pts) Given the following contents of the file animals.txt, how would you use both input and output redirection and the sort command to create a new file called animals-sorted.txt that contains the same contents as in animals.txt by sorted by alphabetical order?

$ cat animals.txt

elephant

kangaroo

dog

bird

mongoose


$


  1. (1pt) Which of the following problems or tasks does a version control system like subversion solve for you?

  1. Allows you to automate repetitive tasks

  2. Allows multiple collaborators to share and sync changes with one another

  3. Allows you to undo changes in time, e.g. see the past history of changes done to a file

  4. Allows you to symbolically debug a program in a more systematic way than using print statements.


Answer(s) (choose all that apply): ________________________






  1. (2pts) If you run the following subversion command and see this output:

$ svn status

M jupiter/moons.txt

C readme.txt

What does the M indicate about the jupiter/moons.txt file? ______________________

What does the C indicate about the readme.txt file? ____________________________


  1. (3pts) Given the following lines in a make file:

----------------------- Makefile ----------------------------


hydroxyl_422.csv : hydroxyl_422.dat hydroxyl_533.dat


dat2csv hydroxyl_422.dat > hydroxyl_422.csv


-------------------------------------------------------------

Label which part is the prerequisite, which part is the target and which part is the action



  1. (5pts) Consider the following command line session:

dharter@chaos:~$ VILLAIN="Derek Harter"

dharter@chaos:~$ bash

dharter@chaos:~$ echo $VILLAIN


dharter@chaos:~$

What is the name of the type of thing that VILLAIN is an example of?


Why was nothing printed out when we did the echo $VILLAIN



What should we do different in the first line (or after it) so that the value of VILLAIN (“Derek Harter”) would have been echoed (instead of nothing being echoed as shown)?


  1. (1pt) The pipe command (| ) is used to:

  1. Redirect the output of a command into a new file

  2. Renumber the output of a command

  3. Run two commands concurrently

  4. Redirect the output of a command into the input of another command

Answer: _________