CSCI330 Fall 2001
Assignment #6
C Shell - Getting Started
(50 points)
Due Tuesday 16 October 2001

This assignment covers these topics: C shell variables, wildcard characters, redirections, and history.

PART A. C SHELL VARIABLE AND WILDCARD CHARACTERS (2 pts each, 10 pts total)

Give the full UNIX commands to accomplish the following tasks. You should record your commands in a typescript file to be submitted.

a1. create/define a shell variable called 'linkdir' and initialize it to the directory pathname: /home/mp/z036473/Assign/csci330

For questions a2 through a10, use the defined variable 'linkdir' and perform the following tasks.

a2. List the contents of the 'linkdir' directory.

a3. List all file names starting with a.

a4. List all file names that end with at least one number digit.

a5. List all file names starting with an a or A.

a6. List all file names ending in a period, followed by a number digit.

a7. List all three character file names that begin with an uppercase letter.

a8. List all file names ending in 11 or 12.

a9. List all file names ending in x or y.

a10. List all file names containing lowercase ab.

PART B. REDIRECTIONS (2 points each; 10 points total)

For questions b1 through b5, assume the command 'set noclobber' has not been set. Give the full UNIX commands to perform the following tasks. Record your work in a typescript file to be submitted.

b1. Redirect the output of the 'ps' command to a file called 'psfile'. Assume 'psfile' does not already exist.

Display the contents of the 'psfile' file.

b2. Append the output of the 'date' command to the file, 'psfile'.

Assume 'psfile' already exists.

Display the contents of the 'psfile' file.

b3. Redirect the output and standard error of the the command 'cat psfile myfile' to a new file called 'catfile'. Assume 'psfile' already exists and 'myfile' does not exist.

Display the contents of the 'catfile' file.

b4. On a single command line, using command sequences, append all the output of the commands:

'date', 'quota -v', 'pwd', and 'du' to a new file called 'disk-usage'.

Display the contents of the 'disk-usage' file.

b5. Create a symbolic link, called 'link.sample1.c' to a C program named 'sample1.c'located in: /home/mp/z036473/Cprograms Using the 'gcc' command, compile the file 'link.sample1.c' and send the standard output and diagnostic/error output to a file called 'error.out'.

Display the contents of the 'error.out' file.

PART C. C SHELL HISTORY (2 points each; 20 points total)

During login, the login process checks to see if the file ~/.history exists. If it does, the commands in that file become the first commands in the history list.

Execute the following commands. Note that you should not create the following three commands in a typescript file yet.

cp /home/mp/z036473/dot.history ~/.history
unset savehist
login

Now you can execute/record all of the commands listed below in a typescript file to be submitted.

After you are logged in again, type the command:

history

You should see: