CS160B

Spring 2018

1:10pm - 3pm (M/W)

Batmale 413

Course Syllabus

Course Syllabus (subject to change throughout the semester)

Homework Assignments are submitted through our course Canvas site

The textbook used for this course is free and available online. In our explorations with the Linux system, we'll regularly be referring to this course text:

The Linux Command Line: A Complete Introduction by William E. Shotts. Jr web reference

Greg Boyd's CS160B Materials CS160B modules

Announcements

Quiz 1 (Take Home) was handed out in class and is due on Wednesday, 4/4/18. We'll be going over the answers together in class then

Quiz 2 was taken in class on 4/25 | histogram

Quiz 3 will be on Wednesday, 5/9.

We will take the Final Exam together on Wednesday, May 16th.

Miscellaneous Information

Using Hills @CCSF for Completing Homework Assignments

Homework Submission

Assignments

Assignment 1 due April 11th | raw

Assignment 2 due April 25th | raw

Assignment 3 (Final Assignment Merged with Assignment 4) | raw

What We Did In Class

Vim

Introduction

Command Substitution, Arithmetic Expansion | Corresponds to Chapter 7 in Shotts

Arguments, Arguments | Corresponds to Chapter 32 in Shotts

How Ifs Work, If Conditionals | Corresponds to Chapter 27 in Shotts

Command Line Editing

Loops, While Loops | Corresponds to Chapter 28 in Shotts

In-Class Lab Assignments to Turn in On Canvas

Due Monday, 3/19/18: In-Class Lab 1: Assignment 3 from CS160A | raw

Due Wednesday, 3/21/18: In-Class Lab 2: A few review questions | raw

Due Monday, 4/9/18: In-Class Lab 3: Scripting Basics Review | raw

Due Wednesday, 4/11/18: In-Class Lab 4: Command Substitution | raw

Due Wednesday, 4/18/18: In-Class Lab 5: If Conditionals | raw

Due Wednesday, 4/25/18: In-Class Lab 6: Functions | raw

Due Wednesday, 5/2/18: In-Class Lab 7: Loops | raw

Due Wednesday, 5/6/18: In-Class Lab 8: Loop2 | raw

Sample Scripts

Week 1: Basic linux commands

helloworld.sh Starting off your code with a shebang

printf.sh printf vs. echo in the bash shell

writeHTML.sh a script to produce an HTML file taken from linuxcommand.org

Week 2: Command substitution

cs160b_Lab1.sh Solution to Lab 1 (demonstrates excellent submission format)

substitution.sh Arithmetic with variables

operator.sh Variable operators

Week 3: Arguments, Parameters

posit-parsm3.sh Taken from Chapter 32 on positional parameters

If Else Example Includes taking input from command line as well.

args.bash Takes in positional parameters

shiftargs.bash Shows shifting position parameters Boyd's exercise

showargs.bash Tool to help take in arguments

Week 4: Conditionals

anycows.bash basic if-else test

countcows.bash counts cows in a single line

dotests.bash do some tests

isit.bash test single argument to see what kind of object it is

isitdirectory.bash test to see if something is a directory

isitfile.bash test to see if something is a file

isitfileordir.bash check if the item is a file or a directory

isithello.bash check whether the argument is hello

isitreadeable.bash check whether argument is readable

isitwriteable.bash check whether the argument is writeable

myss.sh solution to in-class exercise

date.sh solution to in-class exercise

Week 5: Function Use

Error Functions check for error functions

getfile skeleton getfile skeleton code | getfile solution getfile solution

testscript file for getfile

Week 6: Loops

addints adds integers

getalpha repeatedly ask user for input

mycat check for options

normalize script to clean up filenames

whileex1

whileex2

whileex3

whileex4

In-Class Solution Example 1 | example1.sh

Week 7: Substrings