Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Feb 2004 17:56:49 +0100 (CET)
From:      mathias@haas.se
To:        questions@freebsd.org
Subject:   Shell scripting woes
Message-ID:  <51804.193.14.163.194.1077641809.squirrel@mail.haas.se>

next in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?51804.193.14.163.194.1077641809.squirrel>