Can tcsh report 'command had no output'?

Konrad Heuer kheuer2 at gwdg.de
Mon Oct 13 07:42:43 UTC 2008


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 at gwdg.de




More information about the freebsd-questions mailing list