CSE 303: Autumn 2006, Assignment 1

Due: Friday 6 October 2006, 2:00pm

Assignment Goal

This is an individual assignment in which you will get experience using the Linux bash shell, using emacs, and writing a short script.

1. Exploring Commands

First run the command script problem1.txt from the bash prompt. Now try running some commands. The script program you just ran will record what you try. Run at least 75 different commands subject to the following restrictions:

When you are finished, type exit.

2. Exploring Command-line Editing

Suppose you mean to type cat foo, but you accidentally type cta foo. You notice this when the cursor is to the right of the second “o” (you haven’t hit return yet).

Write your solution in a file called problem2.txt.

3. Commands and Output

Use each of the following commands such that hello (and nothing more) is printed (on standard out, and nothing is printed on standard error). You can
precede your commands with other commands (e.g., to create a file) and/or pass options to your commands.

  1. echo
  2. cat
  3. ls
  4. grep
  5. !!

Hint: The last one is tricky. Put a script that does nothing in a file with a particular name.

In a text file called problem3.txt, describe your solution, including each command you use and a very brief explanation of it.

4. Aliases

Put your solution in a file called myaliases. Running source myaliases should successfully add the aliases to the shell.

5. Short Script

Write a bash script in a file mycat that takes 3 or more arguments (let’s call them f1, f2, f3, ..., fn) and works as follows:

This problem can be done in 15 lines. Longer is fine within reason.

Hints: shift, $@, -lt, -a

6. Extra Credit

Note: Remember the course policy on extra credit. You should not expect solving this problem to have a large effect on your grade. It's here for those of you who like a challenge.

Assessment

Your solutions should be

Turn-in instructions

Use the standard turn-in instructiond described here. Your directory should contain the files problem1.txt, problem2.txt, problem3.txt, myaliases, and mycat. If you do the extra credit, put lsdd2 in myaliases and also turn in mycat2.