Re: [dev] New utility "when"
On 2013-12-12 at 04:54, Andrew Gwozdziewycz wrote:
> On 2013-12-11 at 19:08, Fernando C.V. wrote:
>
>> Sounds like a little nice useful utility, even thoguh I don't like
>> that the commands have to be passed "quoted", as arguments just like
>> that. Not sure if there's a much better way to do it, though.
>
> I was thinking about separating commands with ";" (I thought about --,
> but lots of commands actually use it) which would of course need to be
> escaped in the same way find(1) ends -exec and friends. However, I've
> used find in the past for just this type of thing, so maybe it's not
> the right choice, but the full command can always just be quoted --
> you'd have to to use pipes anyway, which is certainly common.
There is another way, as hinted at the beginning of the thread.
On 2013-12-11 at 18:15, Dimitris Zervas wrote:
> Instead of passing a second argument, you could return zero and and it in shell
> when "command" && echo "yup! :D"
Unless you want "when" to stay running and finally return the exit code of the
long running process.
If you go this route, "when" could consume arguments from the beginning of argv,
and then pass the rest of argv to execvp.
Your ssh example becomes:
when -t ssh user_AT_host && xmessage 'Connected'
-Truls
Received on Thu Dec 12 2013 - 11:16:20 CET
This archive was generated by hypermail 2.3.0
: Thu Dec 12 2013 - 11:24:06 CET