NavigationUser loginSpam?See spam posts on this site? If so, please don't reply to the spam! Instead, just report the URL to the webmaster. |
keeping tar quiet in scriptHi all,I'm using a simple script for making backups with tar. I can't make tar quiet, so cron keeps mailing me 'Removing leading `/' from member names' . Adding > /dev/null doesn't help. What can I do to catch tar's output and keep it from shouting all over the place? Tnx,Peter-- Never argue with idiots; they'll drag you down to their own level and beat you on experience. |
keeping tar quiet in script
Scribit Peter Teunissen dies 31/03/2007 hora 21:48:
> Adding > /dev/null doesn't help. What can I do to catch tar's output
> and keep it from shouting all over the place?
What about the classical "1> /dev/null 2>&1"?
Quicky,
Pierre
--
OpenPGP 0xD9D50D8A
keeping tar quiet in script
What about the classical "1> /dev/null 2>&1"?This probably has identical behavior identical to &> /dev/null, but is longer to type.
&>/dev/null seems less portable. Here I have bash and dash, and &>/dev/null does not work under dash. "1> /dev/null 2>&1" works everywhere. -- Software is like sex: it is better when it is free.
keeping tar quiet in script
On Sat, Mar 31, 2007 at 05:01:31PM -0300, Jorge Peixoto de Morais Neto wrote:
> >
> >
> >What about the classical "1> /dev/null 2>&1"?
>
> This probably has identical behavior identical to &> /dev/null, but is
> longer to type.
> &>/dev/null seems less portable. Here I have bash and dash, and &>/dev/null
> does not work under dash. "1> /dev/null 2>&1" works everywhere.
>
The latter is POSIX-compliant. I believe that the "&>" notation is a
bashism.
Regards,
-Roberto
--
Roberto C. Sánchez
http://people.connexer.com/~roberto
http://www.connexer.com
keeping tar quiet in script
I'm using a simple script for making backups with tar. I can't make tar quiet, so cron keeps mailing me 'Removing leading `/' from member names' . Adding > /dev/null doesn't help. What can I do to catch tar's output and keep it from shouting all over the place?
a "> /dev/null" redirects stdout to /dev/null, but stderr is left untouched. a "&> /dev/null" redirects both stdout and stderr to /dev/null.A google search for redirection bash brings you here:
Tnx,Peter-- Never argue with idiots; they'll drag you down to their own level and beat you on experience.
-- Software is like sex: it is better when it is free.
keeping tar quiet in script
On 3/31/07, Jorge Peixoto de Morais Neto <please.no.spam.here@gmail.com> wrote:
I'm using a simple script for making backups with tar. I can't make tar quiet, so cron keeps mailing me 'Removing leading `/' from member names' . Adding > /dev/null doesn't help. What can I do to catch tar's output and keep it from shouting all over the place?
a "> /dev/null" redirects stdout to /dev/null, but stderr is left untouched. a "&> /dev/null" redirects both stdout and stderr to /dev/null.
A google search for redirection bash brings you here:
I'm sorry, hit "send" by accident.I meant:A google search for [redirection bash] brings you here:http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html
Tnx,Peter-- Never argue with idiots; they'll drag you down to their own level and beat you on experience.
-- Software is like sex: it is better when it is free.
-- Software is like sex: it is better when it is free.
keeping tar quiet in script
On 31-mrt-2007, at 21:56, Jorge Peixoto de Morais Neto wrote:On 3/31/07, Jorge Peixoto de Morais Neto <please.no.spam.here@gmail.com> wrote: I'm using a simple script for making backups with tar. I can't make tar quiet, so cron keeps mailing me 'Removing leading `/' from member names' . Adding > /dev/null doesn't help. What can I do to catch tar's output and keep it from shouting all over the place? a "> /dev/null" redirects stdout to /dev/null, but stderr is left untouched. a "&> /dev/null" redirects both stdout and stderr to /dev/null.Yep, that did the trickA google search for [redirection bash] brings you here:http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-3.html Will look at this, looks better than the howto I used until now.Tnx,Peter
keeping tar quiet in script
Le samedi 31 mars 2007 21:55, Jorge Peixoto de Morais Neto a écrit :
> > I'm using a simple script for making backups with tar. I can't make tar
> > quiet, so cron keeps mailing me 'Removing leading `/' from member names'
> > . Adding > /dev/null doesn't help. What can I do to catch tar's output
> > and keep it from shouting all over the place?
>
> a "> /dev/null" redirects stdout to /dev/null, but stderr is left
> untouched.
> a "&> /dev/null" redirects both stdout and stderr to /dev/null.
>
redirecting stderr is good but will also discard other possibly helpful error
messages if something goes wrong. You can simply avoid this particular one
with something like this :
tar -cf archive -C/ .
another trick is to redirect the whole script to some log file (or /dev/null
if you're fearless) by putting this at its beggining :
LOGFILE=...
exec > "$LOGFILE" 2>&1
--
Cédric Lucantis