CS3423 Assignment 0 Solved

30.00 $

Category:

Description

Rate this product

The goals of this assignment are as follows.
• Find the main CS lab at NPB 2.118
• Log in to a machine with your user id
• Utilize some essential Unix commands
• Utilize vi (actually vim) and get familiar with the vi cheat sheet • Create and run a simple shell script

• Learn to submit assignments via Blackboard

This assignment refers to a setup page which can be found on Blackboard under the Miscellaneous section. In particular, you should get visit the vi cheat sheet, Unix cheat sheet, vim tutor, and ssh download if you are planning on using Windows to connect to the department machines.

Steps

1. Log in to Linux

  1. (a)  Go to the CS Department lab at NPB 2.118. If working remotely, see how to log in remotely on the setup page and skip to step 1(e).
  2. (b)  There are two types of workstations in the lab:• Dell Thin Client – (left side of lab) These access the VDI (like the machines in the classrooms). To use them, see the instructions on the setup page.

    • Linux Workstations – (right side of lab) These run Ubuntu 14.04 and are ideal for the work you will do in this course.

  3. (c)  Using a Linux workstation, log in using your abc123 ID. Your password will be defaulted to your UTSA banner ID without the @.
  4. (d)  Open a terminal window. From the desktop menu, use Applications>Accessories>Terminal or Applications>Accessories>LXTerminal
  5. (e)  Since you are using a temporary password, change your password using the passwd command. (Note that the “$” is being used to indicate that the Linux shell is prompting you for input). The actual prompt may look different (e.g., your user ID). In the terminal window, type (without the “$”):$ passwd

    Notes: If you are logging in remotely, do the following instead: • If using Linux:

Assignment 0: Getting Familiar Page 1 of 4

– Start a terminal window and enter the following command:
$ ssh [email protected]
(where abc123 is your abc123 and ii is one of 01 through 06)

• If using Windows:

  • –  You should install ssh (see the setup page).
  • –  You can transfer files with an sftp client (not ftp)
  • –  For both, you will specify [email protected] to connect (where abc123 is your abc123 and ii is one of 01 through 06)
  • –  In the future, consider using a virtual machine (e.g., VirtualBox), dual boot, or Cygwin.2. Create a directory for this course and copy important course files to it. (You may want to check the Unix Cheat Sheet for help here).
  1. (a)  After logging in, check your current directory using the print working directory command: $ pwd
  2. (b)  See what files are in your current directory:$ ls -al

    (This will show all files and give long details on them. You will notice “hidden” files beginning with a “.”.)

  3. (c)  Create a directory for this course:$ mkdir ~/courses/cs3423 -p
  4. (d)  Change to your cs3423 directory:$ cd ~/courses/cs3423
    (You should verify that you are in the directory with the pwd command.)
  5. (e)  Copy the course materials to your directory:$ cp /usr/local/courses/rslavin/cs3423/* . -r
    (You should verify that the material was copied by using the ls command.)

3. Use the vi editor to create a simple shell script.

  1. (a)  Study the vi Cheat Sheet from the setup page.
  2. (b)  (optional) Try the vi tutorial:$ mkdir ~/tmp 2> /dev/null; cd ~/tmp $ vimtutor
    (follow the instructions)
  3. (c)  If you haven’t already in a prior course, create a .vimrc file to set up defaults in vim for indention and line numbers.
    $ vi ~/.vimrc

Assignment 0: Getting Familiar Page 2 of 4

:set ai sw=4
:set number
:set expandtab :set softtabstop=4 :set smartindent

(d) Create your first script for this class using vi. Note: Be careful to type each character, including spaces, exactly as it appears below. Copying and pasting will not preserve spaces correctly.

i. $ cd ~/courses/cs3423 ii. $ mkdir assignments

iii. $ cd assignments iv. $ vi cs3423a0

v. Enter the following code exactly as it appears.

#!/bin/bash

if [ $# -ne 2 ]; then
echo “usage: $0 <firstName > <lastName >” exit 1

fi

echo “My name is $1 $2”
echo “I am running this script from `pwd`” echo “My username is `whoami `”
echo “I am logged in to `hostname`”

4. Exit your text editor and make your script executable:

  $ chmod u+x ./cs3423a0

5. Execute your script and verify the output. In the command below, replace myFirstName and myLastName with your actual name.

$ ./cs3423a0 myFirstName myLastName
It should print the following:
My name is myFirstName myLastName
I am running this script from /home/myUsername/courses/cs3423/assignments My username is myUsername

I am logged in to myHostName
6. You now need to save the output of your script by redirecting the output to a0Out.txt.

$ ./cs3423a0 myFirstName myLastName > a0Out.txt

Assignment 0: Getting Familiar Page 3 of 4

7. Zip all your deliverables into a single zip file for turning in. Your zip file’s name should include your abc123 ID using the format in the command below. You will do this for all assignments going forward.
$ zip -r abc123.zip cs3423a0 a0Out.txt

8. Upload your results to Blackboard.
(a) Visit http://utsa.blackboard.com.
(b) Log in with your abc123 id and passphrase.
(c) Blackboard will show a list of courses. Select CS3423 (not the recitation). (d) Locate Assignment 0 under Assignments
(e) Follow the directions on the screen to upload your zip file.

Note: If you created your script and zip file remotely via ssh, you will need to use either an sftp client or the scp command to move the files from the remote machine to your local one.

  • Assignment0-vlfqlc.zip