Hi,

From: [EMAIL PROTECTED]
Date: Thu, 4 Aug 2005 15:00:49 +1000

> I tried the following
> 
> 
> if [ "$1" = "quiet" ]; then
>      R=">> /home/steven/mfgbacker/serr 2>&1"
> else
>       R=""
> fi
> 
> [...snip...]
> 
> DTEN=`date "+%Y.%m.%d %H:%M:%S"`
> echo "inside makedvd $DTEN" $R
> 
> I=`mkisofs -R -J -q -print-size /back1/tarback/*.tgz`
> J="tsize=${I}s"
> mkisofs -R -J -q -o /back1/tarback/dvd.iso /back1/tarback/*.tgz $R
> cdrecord -sao $J dev=ATAPI:0,0,0 speed=2 driveropts=burnfree 
> /back1/tarback/dvd.iso $R  
> 
> [...snip...]
> 
> The $J substitution into the last command works fine but the $R bit, which 
> attempts to redirect the output to a file, does not.  Bash seems to 
> interpret the >> bit as part of the command rather than a redirection 
> instruction.

My suggestion is using exec commoand to change output.

set_output () {
    if "$QUIET" ; then
        exec 3>&1 4>&2 >> /home/steven/mfgbacker/serr 2>&1
    fi
}

reset_output () {
    if "$QUIET" ; then
        exec 1>&3 2>&4 3>&- 4>&-
    fi
}

if [ "$1" = "quiet" ]; then
     QUIET=/bin/true
else
     QUIET=/bin/false
fi

(snip)

set_output
  mkisofs -R -J -q -o /back1/tarback/dvd.iso /back1/tarback/*.tgz
reset_output
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to