Re: [dev] New utility "when"

From: Samuel Holland <>
Date: Thu, 12 Dec 2013 17:48:18 -0600

>> On Dec 12, 2013, at 4:10 PM, "Fernando C.V." <> wrote:
>> On Thu, Dec 12, 2013 at 10:49 PM, Fernando C.V. <> wrote:
>> This way could do something like:
>> $ when -t ssh host
>>> xmessage DONE!
> Well... even if you didn't prompt it to the user interactively, it
> would still be nice for aliases.
> Probably most of the time you just want to get notfications:
> $ alias retry='echo "xmessage DONE" | when'
> $ retry ssh host

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"
Samuel Holland <>
Received on Fri Dec 13 2013 - 00:48:18 CET

This archive was generated by hypermail 2.3.0 : Fri Dec 13 2013 - 01:36:07 CET