shell script help

Joe Marcus Clarke marcus at marcuscom.com
Tue Jul 22 23:15:17 PDT 2003


On Wed, 2003-07-23 at 02:04, David Bear wrote:
> I'm trying to clean up a script that controls my tape better.  Among
> other things it sets some variable to use later.  I've made an error
> somewhere and I'm thinking that I'm missing the obvious since I cant
> find the error.  I want to set command line options for tar.  Below
> taroptions has what I want.  Line 12 echo's the command.  When I use
> what line echo's to the console tar works.  However, something is
> happening with line 13 that makes tar mad.  It tells me 
> 
> tar can't open the archive /dev/sa0 /var/log
> 
> Please advice -- I'm going blind trying understand this one.
> 
> 
> 1 #!/bin/sh
> 2 PATH=/bin:/usr/bin
> 3 backupadmin="iddwb at asu.edu"
> 4 starttime=`date "+DATE: %Y-%m-%d%nTIME: %H:%M"`
> 5 wrkdir="/root"
> 6 tmpfile=${wrkdir}"/cat.tmp"
> 7 curfile=${wrkdir}"/tapelabel"
> 8 catalog=${wrkdir}"/level1Tar.cat"
> 9 datetime=`date "+DATE: %Y-%m-%d%nTIME: %H:%M"`
> 0 taroptions="--create --verbose --block-size 1 --read-full-blocks --block-compress --gzip --file "
> 1 tapedev="/dev/sa0"
> 2 echo "tar "${taroptions}${tapedev}" /var/log "   
> 3 tar ${taroptions}${tapedev}" /var/log "   
> 4 exit

How about:

0 taroptions="--create --verbose --block-size 1 --read-full-blocks
--block-compress --gzip --file"
1 tapedev="/dev/sa0"
2 echo "tar ${taroptions} ${tapedev} /var/log"
3 tar ${taroptions} ${tapedev} /var/log

Works for me.

Joe

-- 
PGP Key : http://www.marcuscom.com/pgp.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20030723/7abae5a2/attachment.bin


More information about the freebsd-questions mailing list