01-25-07 12:19 PM
Daryl Rose :
> I have a file with about a dozen file names in it. I want to create a
> tar/gzip of those files.
>
> Currently I have it written this way:
>
> CNT=0
> while read line
> do
> if [ $CNT -eq 0 ]
> then
> tar cvf BKUPTST_$DATE.tar $line
> CNT=1
> else
> tar rvf BKUPTST_$DATE.tar $line
> fi
> done < $APP_PATH/$APP/$DB/archive.lst
>
> gzip BKUPTST_$DATE.tar
>
> This works, but I would like to find a better way to do this. BTW, this
> is Unix tar, not a GNU tar. If it were GNU, then I know there are
> options to read in from a file and compress all in one step.
>
> Anyone have any idea's?
>
> Thank you.
> Daryl
>
Does the following code works for you ?
tar cvf BKUPTST_$DATE.tar $(sed 's/\n/ /g' < archive.lst)
[ Post a follow-up to this message ]
|