Re: [dev] New utility "when"

From: Truls Becken <>
Date: Fri, 13 Dec 2013 11:12:35 +0100

On 2013-12-13, at 00:48, Samuel Holland wrote:

> And if you only need simple messages, then there's nothing wrong with having to
> quote the "on success" command:
> $ when -t -c "xmessage Success" <command> <args...>
> The advantage of specifying the message command as an argument (as opposed to
> &&) is that it allows you to pass through the return value of the main command.
> For example, if your long-running program is still running after the timeout,
> you get the message; but it may fail later, and you want to know about that too.
> $ when -t -c 'logger "Service started successfully"' non-forking-service ||
> logger "Service exited unexpectedly"

This. Not loosing exit code of child process in -t mode is a very good thing.

In -z mode, -c "command" and && command will be equivalent.

Received on Fri Dec 13 2013 - 11:12:35 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 13 2013 - 11:24:06 CET