Site Feed

Friday, January 11, 2008

Simple cdrecord Wrapper Script

This little shell script is a good example of how to simplify a task with a wrapper script. Rather than trying to remember which settings to use for cdrecord, I just run my cdroast.sh script.

----- begin script -----



#!/bin/sh
# cdroast.sh
# scottm, 2005-07-20
# wrapper for cdrecord

INPUT=$1

if [ $INPUT ]
then
cdrecord -v -sao dev=0,0,0 $INPUT

else

printf "\nEnter name of file\n"
printf "e.g. $0 filename.iso\n\n"
fi


----- end script -----

Now, with the script in my path, all I have to type is:

$ cdroast.sh myfile.iso

and the burn process will start.

This type of script is often called a wrapper, since it wraps a simple script around a more complicated procedure.

No comments: