[clue-tech] Error messages that can't be redirected
Jim Ockers
ockers at ockers.net
Fri Nov 6 23:06:16 MST 2009
Oh error messages can always be redirected, but sometimes you have to
try harder than others:
basic: command 1>/dev/null 2>/dev/null
or: command 2>&1 >/dev/null
This almost always wins: sh -c "command 2>&1 >/dev/null" 2>&1 >./dev/null
You can keep nesting the sh levels and forcing redirect to /dev/null (or
your output file) if you still get output you weren't expecting.
Matt Gushee wrote:
> Hi folks--
>
> Here's something that's been bugging me for a long time: sometimes I
> will use a command-line program and try to redirect the output, e.g.
> to a log file, and it doesn't work. For example:
>
> for img in *.jpg; do
> nice gm convert -resize 160x160 $img thumbs/$img >> resize.log 2>&1
> done
>
> Nope. I get nothing in my log file. I've tried several variations of
> this command, including piping the output to tee. It just doesn't ever
> work. 'gm', by the way, is GraphicsMagick, a better-performing fork of
> ImageMagick. The same thing happened with ImageMagick, and IIRC with
> some other programs I've used on occasion.
>
> So what's going on here?
>
More information about the clue-tech
mailing list