IT 244: Introduction to Linux/Unix
Homework 4
Due
Sunday, February 23rd at 11:59 PM
What You Need to Do
- Create the script hw4.sh
with Unix commands that will do what is described in the steps
below
- This file must be in an hw4
directory under your hw directory
Setup
-
From your home directory go to your it244
directory
cd it244
- Go to your hw directory
cd hw
- Create an hw4 directory
mkdir hw4
- Enter this new directory
cd hw4
- Create hw4.sh
nano hw4.sh
Specification
- Run
nano
to create
hw4.sh
- Into this file write the Unix commands for each step
- The commands for each step must by labeled with a Step
number
- Write # followed by the word
"Step" and the step number
-
Using one Unix command, go to my home directory using
tilde, ~.
Run pwd
.
-
Using one Unix command, go to your home directory using
tilde, ~.
Run pwd
.
-
You should be in your home directory.
Using one Unix command, go to your hw4
directory inside your
hw directory, inside your
it244 directory using a relative pathname.
Run pwd
.
-
Using one Unix command, go to my home directory using
an absolute pathname.
Run pwd
.
-
Using one Unix command, go to the it244_files
directory inside the course_files directory,
inside my home directory, using an absolute pathname.
Run pwd
.
-
Using one Unix command, go to my home directory using
relative pathname using one or more instances of
.. .
Run pwd
.
-
Using one Unix command, go to your home directory.
Once you are there go to your it244 directory
using a relative pathname.
Run pwd
.
-
You should be in your it244 directory.
Using touch
create a file named test.txt.
Go to your hw4 directory.
Run pwd
.
Using .. stay in your
hw4 directory but list
the contents of your it244 directory.
-
Stay in your hw4 directory and
copy the test.txt file from your
it244 directory to your
hw4 directory using a relative pathname.
Run pwd
.
Run ls
.
-
Using one Unix command go to your home directory.
Run pwd
.
Using one Unix command, copy the test.txt
file from your it244/hw/hw4 directory to
your home directory.
Run ls
.
Testing
- There are two tests that your should run on your script
- The first test checks for Unix errors
- Run bash on your script like this
bash hw4.sh > /dev/null
- This will run your script but will only show error
messages
- If you see nothing, your script has passed this test
- The second test checks your Step comments
- Run it like this
~ghoffman/code/it244_code/testing_scripts_it244/step_comment_check.sh
- When you run this script you must supply your username and
homework number
- If your Step comments are wrong you will lose points
- Run you script
bash hw4.sh
- You should see
/home/ghoffman
/home/YOUR_USERNAME
/home/YOUR_USERNAME/it244/hw/hw4
/home/ghoffman
/home/ghoffman/course_files/it244_files
/home/ghoffman
/home/YOUR_USERNAME/it244
/home/YOUR_USERNAME/it244/hw/hw4
ex hw test.txt
/home/YOUR_USERNAME/it244/hw/hw4
hw4.sh test.txt
/home/YOUR_USERNAME
bin hw1_piazza_filename_create.py names_emails.txt
bugs hw4.py numbers_jumbled.txt
...
- Where you see YOUR_USERNAME substitute
your Unix username
Copyright © 2020 Glenn Hoffman. All rights reserved. May not be reproduced without permission.