AIX

AIX

Connect with fellow AIX users and experts to gain knowledge, share insights, and solve problems.

 View Only
Expand all | Collapse all

set a variable on a filename created by tee ?

  • 1.  set a variable on a filename created by tee ?

    Posted Thu February 12, 2009 03:32 PM

    Originally posted by: SystemAdmin


    Greetings to the forum..

    im very new to AIX and have been trying to get a simple script working.my purpose is to backup a directory on tape and compress the log that the process creates.so i have done something like.

    find . -print | backup -viqf /dev/rmt0 | tee /home/bfi/testfile_`date +%Y_%m_%d`.log
    but i want to be able to compress that .log file.how is it possible to set a variable on that file and then use compress $myvar and do the job?
    i tried sth like find . -print | backup -viqf /dev/rmt0 | myvar=$(tee /home/haroulis/testfile_`date +%Y_%m_%d`.log)
    but myvar ends up having all filenames of the directory. since that would occur daily and therefore my filename would be different and i dont know of way to always set myvar$ to be that file so i can pass it on to compress.
    im using bash on aix 5.3

    thank you.


  • 2.  Re: set a variable on a filename created by tee ?

    Posted Mon February 16, 2009 10:20 AM

    Originally posted by: MarkTaylor


    >> find . -print | backup -viqf /dev/rmt0 | myvar=$(tee /home/haroulis/testfile_`date +%Y_%m_%d`.log)

    ...eh ???

    log="/home/haroulis/testfile_`date +%Y_%m_%d`.log"
    find . -print | backup -viqf /dev/rmt0 | tee $log
    gzip $log

    HTH
    Mark Taylor