CS 330 Lecture 40 – Shell scripting, or Why I love Linux
- shell scripting
- programs are methods
- speed and terseness
- caters to file manipulation
- I/O redirection
- some problems
- resizing a bunch of images
- comparing two directories
- change extensions on a bunch of files
- checking for new mail
- sending spam
- finding big files
- preparing code for blog posts
mkdir -p dialup_friendlies
for img in *.JPG; do
convert $img -resize 300x300 dialup_friendlies/$img
mailx -A uwec -H | grep '^ U' > /dev/null
if [ $? -eq 0 ]; then
echo "You have mail."
for username in $(cat usernames.txt); do
echo Sending mail to $username...
mailx -A uwec -s "[CS 330] Lecture Spam" -r email@example.com $firstname.lastname@example.org < message.txt
Languages are streets.
Paving them smooth is pointless…
Until you’re hauling stuff.