From owner-freebsd-questions Mon Mar 17 11:38: 4 2003 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 3F29837B401 for ; Mon, 17 Mar 2003 11:38:03 -0800 (PST) Received: from ms-smtp-01.nyroc.rr.com (ms-smtp-01.nyroc.rr.com [24.92.226.148]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5DE7543F85 for ; Mon, 17 Mar 2003 11:38:02 -0800 (PST) (envelope-from tparquet@twcny.rr.com) Received: from twcny.rr.com (syr-66-24-56-65.twcny.rr.com [66.24.56.65]) by ms-smtp-01.nyroc.rr.com (8.12.5/8.12.2) with ESMTP id h2HJc167011628 for ; Mon, 17 Mar 2003 14:38:01 -0500 (EST) Message-ID: <3E762419.3040900@twcny.rr.com> Date: Mon, 17 Mar 2003 14:38:01 -0500 From: Tom Parquette User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.2.1) Gecko/20030218 X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-questions@FreeBSD.org Subject: Shell scripting questions Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 I've been looking through some basic shell books, and some online resources, that I have but I'm not finding the answer. Or maybe I just don't recognize the answer when I see it... I'm building a schell script that will backup my systems to CD-ROM. Or DVD when I can talk my wife into a burner. :-) I'm stuck on two items: 1) Since my tar files CAN exceed the capacity of a CD-ROM, I want to check in the script if I have to call split. The closest I can come to determining the size of the output file from tar (e.g.ad0s1a.tgz) is: file_size=`du -k /tmp/ad0s1a.tgz`. The problem I have is, while this gives me the result in number of K blocks, it also returns the file name and directory. I don't know how to get JUST the number of K blocks so I can do a numeric compare against 700m. 2) I have a function written that will tar/gzip the filesystem then split it into pieces that will be turned into .iso files that will be fed to burncd. I would like to capture the output of commands (e.g. ls -l /tmp/ad0s1a.*) into a "table" that I can examine to determine what was output by the split command so I know what mkisofs commands, and how many, I have to build/execute. Example: If I end up with a ad0s1a.tgz.aa, ab, and ac from split, I know I have to do mkisofs' for 3 files. I also hope to use the same technique for determining what filesystems I have to backup in the first place. e.g. If I do a df command I want to pull out the filesystem name and what mountpoint it is on. The mountpoint is important to me because I do not want to back up some filesystems. e.g. I do not want to backup /tmp. TIA. Cheers... To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message