teaching machines

CS 330 Lecture 3 – Shell Scripting Cont’d

Agenda

  • what ?s
  • mass programming
    • bookmark a directory
    • safe rm
    • top10 big files
    • upload file to www share directory
    • re-extension

TODO

  • Read Eric Raymond’s Basics of the Unix Philosophy.
  • On a 1/4 sheet, write down 2-3 questions, observations, or your own laws for developing software.

Note

Today we’re going to continue writing shell scripts together. On Monday, we dive into Ruby.

Code

book

#!/usr/bin/env zsh

echo $(pwd) > $HOME/.bm

koob

#!/usr/bin/env zsh

echo -n "Before: "
pwd
cd $(cat $HOME/.bm)
echo -n "After: "
pwd

forothersify

#!/usr/bin/env zsh

scp $1 twodee.org:/home2/twodeeor/www/share
ssh twodee.org "chmod o+r /home2/twodeeor/www/share/${1:t}"

top10

#!/bin/sh

du . | sort -nr | head -n10

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *