Re: [9fans] test command

2008-09-11 Thread Kenji Arisawa

Hello,

On 2008/09/11, at 11:38, Russ Cox wrote:


there are certainly better ways to do this, but this works:


as does /bin/mtime.


I didn't know this command.

thanks russ and erik.

Kenji Arisawa




[9fans] test command

2008-09-10 Thread Kenji Arisawa

Hello,

test command of plan 9 has a operator older, the usage is:
test f -older t
where f is a file and t is a time.
however the command does not have newer operator.
why?

Kenji Arisawa




Re: [9fans] test command

2008-09-10 Thread ron minnich
On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa [EMAIL PROTECTED] wrote:
 Hello,

 test command of plan 9 has a operator older, the usage is:
test f -older t
 where f is a file and t is a time.
 however the command does not have newer operator.
 why?


If a  b, and you want to know if b  a, can't you just do a  b?

ron



Re: [9fans] test command

2008-09-10 Thread Rodolfo kix García

a  b = !(a  b) + (a = b)

 On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa [EMAIL PROTECTED]
 wrote:
 Hello,

 test command of plan 9 has a operator older, the usage is:
test f -older t
 where f is a file and t is a time.
 however the command does not have newer operator.
 why?


 If a  b, and you want to know if b  a, can't you just do a  b?

 ron




-- 
Rodolfo García AKA kix
http://www.kix.es/
EA4ERH (@IN80ER)




Re: [9fans] test command

2008-09-10 Thread David Leimbach
On Wed, Sep 10, 2008 at 6:38 AM, ron minnich [EMAIL PROTECTED] wrote:

 On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa [EMAIL PROTECTED]
 wrote:
  Hello,
 
  test command of plan 9 has a operator older, the usage is:
 test f -older t
  where f is a file and t is a time.
  however the command does not have newer operator.
  why?
 

 If a  b, and you want to know if b  a, can't you just do a  b?

 ron


Yeah with  and ! you can build anything you want :-)

Hence why many C++ STL comparisons just require you to make a functor for
less.

Dave


Re: [9fans] test command

2008-09-10 Thread Juan Céspedes
Maybe I'm confused, but what Kenji said is that:

 test command of plan 9 has a operator older, the usage is:
test f -older t
 where f is a file and t is a time.

If f is a file ant t is a *time*, you can't do test t -older f

Juan



Re: [9fans] test command

2008-09-10 Thread Gorka Guardiola
On Wed, Sep 10, 2008 at 5:27 PM, Juan Céspedes [EMAIL PROTECTED] wrote:
 Maybe I'm confused, but what Kenji said is that:

 test command of plan 9 has a operator older, the usage is:
test f -older t
 where f is a file and t is a time.

 If f is a file ant t is a *time*, you can't do test t -older f


yes, but !older is the same as younger or equal.
!(test f -older t)
would be the same (equality notwithstanding)
as
test f -younger t

But then there is = and != for strings (for example), so this argument
is thin :-).
-- 
- curiosity sKilled the cat



Re: [9fans] test command

2008-09-10 Thread erik quanstrom
  But then there is = and != for strings (for example), so this argument
  is thin :-).
 
 if we can easily get modified time of a file in the format of UNIX time,
 where easily means in the set of plan 9 commands.

there are certainly better ways to do this, but this works:

- erik

#!/bin/rc
rfork e

p='
$1 == mtime: {
gsub([()], , $8)
print $8
}'

for(i){
syscall -s fstat 0 buf 1024$i[2=1] | 
awk $p
}