From owner-freebsd-questions@FreeBSD.ORG Thu Apr 21 08:07:34 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EC9CC106564A for ; Thu, 21 Apr 2011 08:07:34 +0000 (UTC) (envelope-from riaank@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 81E798FC13 for ; Thu, 21 Apr 2011 08:07:34 +0000 (UTC) Received: by wyf23 with SMTP id 23so1524186wyf.13 for ; Thu, 21 Apr 2011 01:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=lICC7dgo41JfAOsB50svigThAMhE7uOjsVl0Es9AD7o=; b=x6PRRmjR7o0oGb8ctWHzIZGbitv26XiDidr5kkfGT6ZfwsyNTufK3fw0Wy2kQz7dUI pMLtj5qV/iYCGXjHBvMSr6Q1pqRjKk/sS4WMUQJd/pK6HugR1MFdN+CBGhGJFP0dBAR2 qItFqT3tj+KeGwF+/2RGRYjU3OBhxEruoaS00= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=XJ3UtjjsimLivDNs0p8fAcXvYuaJfsAw7CL31soR29NmveCLgRSvGmqB9Vd9X6DzG7 8+QX0q4xEQdRHWrkYrNUxQWtmz724kg2FaE76ekwOqGDazQI9UYauvD8DQPjUaCoIJDd xpYgpb7kFhCA79m+fdkQOpIavZslTkBioPvgU= MIME-Version: 1.0 Received: by 10.227.154.12 with SMTP id m12mr3375227wbw.193.1303371369275; Thu, 21 Apr 2011 00:36:09 -0700 (PDT) Received: by 10.227.210.2 with HTTP; Thu, 21 Apr 2011 00:36:09 -0700 (PDT) In-Reply-To: <20110420130106.GA30295@ei.bzerk.org> References: <4DAD9594.8030108@cyanide-studio.com> <20110420130106.GA30295@ei.bzerk.org> Date: Thu, 21 Apr 2011 09:36:09 +0200 Message-ID: From: Riaan Kruger To: freebsd-questions@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Re: redirecting command output depending on exit status X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 21 Apr 2011 08:07:35 -0000 > > > I have a cron task set up using lockf. > > > > I'd like to redirect one exit status to /dev/null : > I think that the exit status of a command will be after any output of the command to stderr or stdout. So first it will say "This is wrong" and then it will exit giving you the exit code. The only thing I can think of is to write a wrapper script which in effect parses out the error message for example: command | grep -v "offending message" > logfile Regards Riaan