Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Oct 2008 09:42:40 +0200 (CEST)
From:      Konrad Heuer <kheuer2@gwdg.de>
To:        Kelly Jones <kelly.terry.jones@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Can tcsh report 'command had no output'?
Message-ID:  <20081013092722.S9114@gwdu60.gwdg.de>
In-Reply-To: <26face530810120930u121e8658hb93b93bc32e52a3b@mail.gmail.com>
References:  <26face530810120930u121e8658hb93b93bc32e52a3b@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help

On Sun, 12 Oct 2008, Kelly Jones wrote:

> Can I force tcsh to say "previous command returned empty stdout" or
> something? I often cut and paste shell output for my cow-orkers, and
> it's crucial to note when a command returns nothing.
>
> Currently, I insert the information manually:
>
>> ls | fgrep 'phrase'
> [no results]
>
> but it'd be nice if tcsh had a setting to do this automatically?

Afaik there is no such setting. You could try something like

set output = `command`
if ( "$output" == "" ) then
   echo "previous command returned empty stdout"
else
   echo "$output"
endif

in your scripts (if you're scripting). Not perfect since newlines are 
removed by command substitution, but maybe a starting point ...

Best regards

Konrad Heuer
GWDG, Am Fassberg, 37077 Goettingen, Germany, kheuer2@gwdg.de





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