From owner-freebsd-questions@FreeBSD.ORG Tue Feb 24 08:51:31 2004 Return-Path: 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 7AAB216A4CE for ; Tue, 24 Feb 2004 08:51:31 -0800 (PST) Received: from mxfep02.bredband.com (mxfep02.bredband.com [195.54.107.73]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5C5B443D1D for ; Tue, 24 Feb 2004 08:51:30 -0800 (PST) (envelope-from mathias@haas.se) Received: from haas.se ([213.114.148.49] [213.114.148.49]) by mxfep02.bredband.com with SMTP id <20040224165129.BOPU5839.mxfep02.bredband.com@haas.se> for ; Tue, 24 Feb 2004 17:51:29 +0100 Received: (qmail 27195 invoked from network); 24 Feb 2004 16:56:49 -0000 Received: from mathias@haas.se by p3-550.haas.se by uid 82 with qmail-scanner-1.20 (spamassassin: 2.61. Clear:RC:1(127.0.0.1):. Processed: 56:49 -0000 Received: from localhost.haas.se (HELO mail.haas.se) (127.0.0.1) by: 56:49 -0000 Received: from 193.14.163.194 (SquirrelMail authenticated user mathias@haas.se) by mail.haas.se with HTTP; Tue,: 56:49 +0100 (CET) Message-ID: <51804.193.14.163.194.1077641809.squirrel@mail.haas.se> Date: Tue, 24 Feb 2004 17:56:49 +0100 (CET) From: mathias@haas.se To: questions@freebsd.org User-Agent: SquirrelMail/1.4.2 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 Importance: Normal Subject: Shell scripting woes X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Feb 2004 16:51:31 -0000 Hello guys! I have two questions about shellscripts: 1) I have a backup job that 'tar's a lot of files and currently I redirect all output of the job to a log. Tar unfortunately lists all directories that it goes through, even if nothing is 'tar'ed in those directories. So my logfile contains all my directories. I want to filter out all lines in my tar-log that ends with slash ("/") since those are directories. I want to sort of do an inverse grep on the last character when tarring. Like: tar -cvf myback.tar |grep -v "all lines that end with slash" > log.txt. All files that are backed up contain the whole directory path (that's how I want it) - so I can't simply do a reverse grep for the slash-char. Maybe you could do something with awk? I'm a total rookie with awk, so I'm lost there... 2) The same backup job - is written as a bash script, and it works perfectly when run by hand, but it won't run as a cron job. In fact I can't seem to run even the simplest of shellscripts as a cronjob. I've searched a lot on Google, but even though I guess that this is really simple, I can't find what's blocking shellscripts in Cron. Other cronjobs but shellscripts run fine. I've tried to enter the SHELL parameter in crontab too... Thanks for any feedback! Regards, Mathias Haas.