# teaching machines

## CS 330 Lecture 3 – Shell Scripting, Part 2

Dear students,

We will continue to work with the shell, a world between worlds. A place full of dead mice. Let’s start with a reading review:

1. What does it mean for a directory to be executable?
2. Write a command to run program place, reading from file bets and appending its output to file log.
3. What will file .. report?
4. Your program webify generates a lot of HTML. Write a command to only show the img tags.

Now it’s time for a segment I like to call What Does This Do? We’ll spend a moment absorbing each code snippet, and then I’ll ask what they do and what would be a good name for the script.

• WDTD #1
for i in $@; do mv$i $(date +%Y%m%d)_$i
done
• WDTD #2
base=$(basename -s .c$1)

#### save

#!/bin/bash

pwd > ~/.dirmark