|
Due: 5:00 p.m. EST, Friday 23 September 2005.
Weight: 5% of course grade.
Question 1
Follow the instructions given to you by your instructor to check
out a copy of the Subversion repository you'll be using in this
course. Unless otherwise noted, the exercises below assume that you
have done this, and that your working copy is in a directory called
course. You will submit all of your
exercises in this course by checking files into your repository.
Question 2
Create a file course/ex01/bio.txt (where
course is the root of your working copy of
your Subversion repository), and write a short biography of yourself
(100 words or so) of the kind used in academic journals, conference
proceedings, etc. Commit this file to your repository. Remember to
provide a meaningful comment when committing the file!
Question 3
What's the difference between mv and svn mv? Put the answer in a file called course/ex01/mv.txt and commit your changes.
Once you have committed your changes, type svn
log in your course directory. If you
didn't know what you'd just done, would you be able to figure it out
from the log messages? If not, why not?
Question 4
Add another line or two to course/ex01/bio.txt and commit those changes.
Then, use svn merge to restore the original
contents of your biography (course/ex01/bio.txt), and commit the result. When
you are done, bio.txt should look the way it
did at the end of the first part of the previous exercise.) Note: the
purpose of this exercise is to teach you how to go back in time to get
old versions of files&emdash;while it would be simpler in this case
just to edit bio.txt, you can't (reliably) do that when you've made
larger changes, to multiple files, over a longer period of time.
Question 5
Suppose you want to remove all files whose names (not including
their extensions) are of length 3, start with the letter .txt as extension. What command would
you use? For example, if the directory contains three files a.txt, abc.txt, and
abcd.txt, the command should remove abc.txt , but not the other two files.
Submit your answer in course/ex01/q05.txt
in your Subversion repository.
Question 6
What does the command cd ~ do? What about
cd ~gvwilson?
Submit your answer in course/ex01/q06.txt
in your Subversion repository.
Question 7
What's the difference between the commands cd
HOME and cd $HOME?
Submit your answer in course/ex01/q07.txt
in your Subversion repository.
Question 8
Suppose you have written a program called analyze. What command or commands could you use
to display the first ten lines of its output? What would you use to
display lines 50-100? To send lines 50-100 to a file called tmp.txt?
Submit your answer in course/ex01/q08.txt
in your Subversion repository.
Question 9
The command ls data > tmp.txt writes a
listing of the data directory's contents
into tmp.txt. Anything that was in the file
before the command was run is overwritten. What command could you use
to append the listing to tmp.txt
instead?
Submit your answer in course/ex01/q09.txt
in your Subversion repository.
Question 10
What do the commands pushd, popd, and dirs do? Where
do their names come from?
Submit your answer in course/ex01/q10.txt
in your Subversion repository.
Question 3
mv is a Unix command, which you can apply
to any file or directory to change its name (or location). svn mv is a sub-command of Subversion, and you can
only apply it to something that's under version control. It renames
(or moves) a file or directory, but Subversion keeps track of where
the new file or directory came from. Note that svn
mv only acts on your working copy; you have to use svn commit in order to push that change into the
repository.
Question 5
rm a??.txt.
Question 6
cd ~ "moves" you (i.e., changes your
current working directory) to your home directory. cd ~gvwilson attempts to change working directory
to gvwilson's home directory. If you don't have
permission to be there, the operation fails.
Question 7
cd HOME attempts to move to a directory
called HOME directly below the current
directory. cd $HOME moves you to your home
directory, because $HOME is a reference to the
environment variable HOME, whose values is always the
absolute path to your home directory.
Question 8
The commands are:
analyze | head -10 analyze | head -100 | tail -51 analyze | head -100 | tail -51 > tmp.txt
Question 9
Use ls data >> tmp.txt. Note the
double greater-than sign: this means "append", instead of
"redirect".
Question 10
pushd pushes the current working directory
onto a stack of directories, and changes your current directory to
dir. popd takes
the top directory from the directory stack, and moves you there.
Thus:
pushd /tmp ...do something... popd
moves you to the /tmp directory, where
you do some work, and then takes you back to wherever you were before.
dirs print out the current directory
stack. The leftmost directory is the top of stack.
| Grade/20 | Students |
|---|---|
| 20 | 21 |
| 19 | 19 |
| 18 | 3 |
| 17 | 2 |
| 16 | 1 |
| 14 | 1 |
| 12 | 1 |
| 6 | 2 |
| 4 | 1 |