Scripting

Scripting in Linux is a way to speed up a systems administrator's job. All those tasks that take 5 or 6 commands can be put into a script and even scheduled to run automatically. This week, we're going to write scripts to manipulate images using a utility called [|ImageMagick].

=Day 1 Goal=

Get comfortable with the convert command. Try to resize an image and change the file format. For example, try converting a picture to be a "thumbnail" image, 100 pixels wide.

Tasks:
 * Size an image down (-size option)
 * Crop an image (-crop option)
 * Rotate an image (-rotate option)

[|ImageMagick documentation] convert man page
 * Resources:**

=Day 2 Goal=

Recreate yesterday's convert command in a shell script. Your script should take an image's filename as input, change the image's size and file format.

Tasks:
 * Write a shell script
 * Make it take input from the commandline
 * Make it executable
 * Make it do everything from Day 1

=Day 3 Goal=

Adapt your script to batch process an entire directory of images.

Tasks:
 * Resize all images in a directory
 * Rotate all images in a directory

=Day 4 Quiz=

Quiz on Thursday: write a new shell script based on what you learned this week. I'll give you some images and ask you to do something with them all. What I ask, exactly, is top secret and will be revealed on Thursday.

=Day 5 (Monday, Apr. 15)=

Putting conditions in your script (if/then statements). Start with this [|BASH Programming Conditionals] page.

Objectives:
 * Describe the basic if/then theory
 * Write an if/then statement for a BASH script (syntax matters!)
 * Adjust a sample program to run all branches of the if/then statement

=Day 6=

What "else"? Adding the "else" bit into your if/then statements. Return to the [|BASH Programming Conditionals] page to find out how.

Objectives:
 * Describe what "else" does
 * Write a sample script to practice with else

=Day 7=

Practice some more complex scenarios provided by Megan.

=Day 8 (Friday, Apr. 18)=

Quiz day!