From owner-freebsd-questions Sun Jul 28 9:26:39 2002 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 01DDF37B400 for ; Sun, 28 Jul 2002 09:26:36 -0700 (PDT) Received: from zephir.primus.ca (mail.tor.primus.ca [216.254.136.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C26343E42 for ; Sun, 28 Jul 2002 09:26:35 -0700 (PDT) (envelope-from leth@primus.ca) Received: from dialin-131-211.hamilton.primus.ca ([209.90.131.211]) by zephir.primus.ca with esmtp (Exim 3.33 #16) id 17YqsL-0004V8-0A; Sun, 28 Jul 2002 12:26:34 -0400 Date: Sun, 28 Jul 2002 12:26:35 -0400 (EDT) From: Jason Hunt X-X-Sender: leth@lethargic.dyndns.org To: freebsd-questions@FreeBSD.ORG Cc: Michelle Weeks Subject: Re: Backup Scripts In-Reply-To: <5703127A-9FEF-11D6-A5A4-00039368B8EC@mindspring.com> Message-ID: <20020728120510.J1068-100000@lethargic.dyndns.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 25 Jul 2002, Michelle Weeks wrote: > #! /bin/sh > # Variables > EMAILTO=backup > DESTFILE=/dev/nrsa0 > BACKUPFILES="/var /usr/home" > BACKUPDIR=${HOME}/backup > LEVEL=1 In your original message on July 23rd, you had "LEVEL=${0}" instead of "LEVEL=0" or "LEVEL=1". With "LEVEL=${0}", you were getting "Error: Level-backup.sh unknown" when you tried to run the script. ${0} is a variable for the name of the script. ${1} through ${9} are for command-line arguments. It seems that the person who wrote this script intended it to be ran as "backup.sh 0" or "backup.sh 1", and that argument is passed to ${LEVEL}. The script then checks for ${LEVEL} to be of the value "0" or "1", otherwise it exits with the "Level-${LEVEL} unknown" error. The code for that is in the tar_backup() function: if [ "${LEVEL}" = "0" ]; then <... etc ...> elif [ "${LEVEL}" = "1" ]; then <... etc ...> else # Backup level error echo "Error: Level-${LEVEL} unknown" exit What you might want to do is put "LEVEL=${1}" and then run the script using "backup.sh 0" and "backup.sh 1" to get the different levels without having to modify the file. Does any of this make sense? I'm better at programming, not explaining or teaching it. :) > Level-1 Backup END > Level-1 Backup Verify Wed Jul 24 15:38:47 PDT 2002 > tar: echo not found in archive > tar: Level-1 Backup Verify END not found in archive > [ ... snip ... ] > > # tar_verify function: test the archive for errors > tar_verify () > { > echo "Level-${LEVEL} Backup Verify ${NOW}" > # Backup verify test > tar --list --verbose \ > --file ${DESTFILE} \ > echo "Level-${LEVEL} Backup Verify END" > } > The \ at the end of a line means that the said line continues onto the next (line). The script is trying to run the command "tar --list --verbose --file ${DESTFILE} echo "Level-${LEVEL} Backup Verify END"". Remove the \ off the end of "--file ${DESTFILE} \". This will cause the script to run "tar --list --verbose --file ${DESTFILE}" and then " echo "Level-${LEVEL} Backup Verify END"", which seems to be the intention. Hope this helps. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message