Re: [dev] New utility "when"

From: Andrew Gwozdziewycz <web_AT_apgwoz.com>
Date: Wed, 11 Dec 2013 13:21:40 -0500

On Wed, Dec 11, 2013 at 1:14 PM, Patrick <201009-suckless_AT_haller.ws> wrote:
> On 2013-12-11 12:21, Andrew Gwozdziewycz wrote:
>> Yes. You can do exactly that. But you *can't* do:

Sorry, I shouldn't have said *can't*, since I knew it was *possible.*

>> when -t "ssh user_AT_host" "xmessage 'Connected'"
>
> Time to rock the IPC?
>
> #!/bin/bash
> MAGIC=5
>
> system_time_epoch() { date +%s; }
> file_time_mod() { stat --printf='%Y' $1 ; }
> file_age() { echo $(( $(system_time_epoch) - $(file_time_mod "$1") )); }
>
> tmp="/tmp/michael_jackson_touched_my_$$"
> touch $tmp
>
> (
> while test $( file_age $tmp) -lt $MAGIC; do sleep 1; done
> xmessage "wtf? you let him touch your $$"
> ) &
>
> while ! ssh $there ; do
> touch $tmp
> done


However, look at that. It's not exactly something you're going to do
just one off.



-- 
http://apgwoz.com
Received on Wed Dec 11 2013 - 19:21:40 CET

This archive was generated by hypermail 2.3.0 : Wed Dec 11 2013 - 19:24:16 CET