CSUMS, Monday, May. 18

Shell scripting exercises.

Vim

First, a note on text editing: I think that the very best way to edit shell scripts (or text files of any type) is to use Vim. There is a wealth of online resources for this amazing text editor, as you can see here.

Exercise 0. A good way to get acquainted with vim is to edit your vimrc file to get coloring, spell-check, and other cool features to start up automatically when you load vim. You will need to create this file from scratch by typing vim .vimrc into the terminal, and then adding the lines you want. There is more information that you need on this process available here. I have a text copy of my own vimrc file for you to look at as well.

AWK

Dr. Kostelich has an excellent introduction to AWK on his website. For more information, see the GNU Awk user's guide, or any of the other resources.

Exercises. Complete Dr. Kostelich's Awk exercises.

Makefiles

The GNU make utility is designed to compile and link several different programs.

Exercise. Here is a tar file containing several Fortran files that need to be linked and compiled together. Write a makefile that does so. Here is some code to get you started.

Exercise. Edit the makefile from the previous exercise so that it contains clean and backup commands as well.

BASH

Exercise. Write a BASH job script that can be used on Saguaro to run the newton program. Here is a skeleton job script to get you started. The Fulton HPC website has more information on writing job scripts as well.

Created in 2009 by Taylor Hines. Not for general distribution; some of this content is borrowed from other sources.