i am brewing up a backup script, but i am running into an error which has me baffled.
i try to run the script and get a syntax error which look something like this: syntax error near unexpected token 'elif' this is the line in question: elif [ ! -f "/backup/current/*fullbackup.tar.gz" ] here is the complete file (sorry, the formatting is mangled (no indetions, etc)): #! /bin/sh # jason pepas's backup script - see http://jason.pepas.com # see http://www.freeos.com/guides/lsst/ for shell script tutorial # -------------------------------------------------- # set variables: # -------------------------------------------------- directoryname=`date +%y-%m-%d`"backup" fullbackupname=`date +%y-%m-%d`"fullbackup.tar.gz" incrementalbackupname=`date +%y-%m-%d`"incrementalbackup"`date +%H%M`".tar.gz" # -------------------------------------------------- # main routine: # -------------------------------------------------- if [ `date +%A` = "Sunday" && ! -f "/backup/$directoryname" ] then # if it is sunday and you havent yet done a full backup, do so fullbackup elif [ ! -f "/backup/current/*fullbackup.tar.gz" ] # if there is no current fullbackup, make one fullbackup else # otherwise, do an incremental backup incrementalbackup fi # end if statement # -------------------------------------------------- # functions: # -------------------------------------------------- fullbackup() { # create backup directory mkdir /backup/$directoryname # create (or update) a shortcut called current to this directory rm /backup/current ln -s /backup/$directoryname /backup/current # keep track of creation date of full backup (used with incremental backups) `date`>/backup/current/lastfullbackupdate # create backup tar --create --files-from /backup/whattobackup --exclude-from /backup/whatnottobackup --absolute-names --verbose --verify --gzip --fil e /backup/current/$fullbackupname } incrementalbackup() { # create variable with date of last full backup `cat /backup/current/lastfullbackupdate`>$lastfullbackupdate # create backup if [ ! -f "/backup/current/$incrementalbackupname" ] then tar --create --files-from /backup/whattobackup --exclude-from /backup/whatnottobackup --after-date $lastfullbackupdate --absolute-names --verbose --verify --gzip --file /backup/current/$incrementalbackupname fi } jason [EMAIL PROTECTED] jason.pepas.com