--On Friday, June 06, 2003 10:37:04 -0700 Peter Jay Salzman <[EMAIL PROTECTED]> wrote:
ever since i learned perl a year or two ago, i literally haven't touched
shell scripting other than reading other people's scripts, so i'm a bit
rusty, however, i think bourne style conditionals have the form:

if [ condition ]
then
do something
fi

or:

if test condition
then
do something
fi

Any command (or pipeline) can follow the if. "test condition" and "[ condition ]" are just commands commonly used here. Something like this is perfectly legal:


        if mkdir -p $workingdir
        then
                cd $workdir
        else
                # mkdir would have printed an error message
                exit 1
        fi

Although my scripts generally create directories like this:

[ -d $dir ] || mkdir -p $dir || exit 1

--
Kenneth Herron  [EMAIL PROTECTED]     916-366-7338
_______________________________________________
vox-tech mailing list
[EMAIL PROTECTED]
http://lists.lugod.org/mailman/listinfo/vox-tech

Reply via email to