9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] test command
@ 2008-09-10 10:19 Kenji Arisawa
  2008-09-10 13:38 ` ron minnich
  0 siblings, 1 reply; 10+ messages in thread
From: Kenji Arisawa @ 2008-09-10 10:19 UTC (permalink / raw)
  To: Fans Bell Labs of the OS Plan 9 from

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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 10:19 [9fans] test command Kenji Arisawa
@ 2008-09-10 13:38 ` ron minnich
  2008-09-10 14:16   ` Rodolfo kix García 
  2008-09-10 15:21   ` David Leimbach
  0 siblings, 2 replies; 10+ messages in thread
From: ron minnich @ 2008-09-10 13:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa <arisawa@ar.aichi-u.ac.jp> 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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 13:38 ` ron minnich
@ 2008-09-10 14:16   ` Rodolfo kix García 
  2008-09-10 15:21   ` David Leimbach
  1 sibling, 0 replies; 10+ messages in thread
From: Rodolfo kix García  @ 2008-09-10 14:16 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


a < b = !(a > b) + (a = b)

> On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa <arisawa@ar.aichi-u.ac.jp>
> 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)




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 13:38 ` ron minnich
  2008-09-10 14:16   ` Rodolfo kix García 
@ 2008-09-10 15:21   ` David Leimbach
  2008-09-10 15:27     ` Juan Céspedes
  1 sibling, 1 reply; 10+ messages in thread
From: David Leimbach @ 2008-09-10 15:21 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

[-- Attachment #1: Type: text/plain, Size: 623 bytes --]

On Wed, Sep 10, 2008 at 6:38 AM, ron minnich <rminnich@gmail.com> wrote:

> On Wed, Sep 10, 2008 at 3:19 AM, Kenji Arisawa <arisawa@ar.aichi-u.ac.jp>
> 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

[-- Attachment #2: Type: text/html, Size: 1174 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 15:21   ` David Leimbach
@ 2008-09-10 15:27     ` Juan Céspedes
  2008-09-10 16:15       ` Gorka Guardiola
  0 siblings, 1 reply; 10+ messages in thread
From: Juan Céspedes @ 2008-09-10 15:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 15:27     ` Juan Céspedes
@ 2008-09-10 16:15       ` Gorka Guardiola
  2008-09-11  0:23         ` Kenji Arisawa
  0 siblings, 1 reply; 10+ messages in thread
From: Gorka Guardiola @ 2008-09-10 16:15 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Wed, Sep 10, 2008 at 5:27 PM, Juan Céspedes <cespedes@lsub.org> 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



^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-10 16:15       ` Gorka Guardiola
@ 2008-09-11  0:23         ` Kenji Arisawa
  0 siblings, 0 replies; 10+ messages in thread
From: Kenji Arisawa @ 2008-09-11  0:23 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

Hello,

On 2008/09/11, at 1:15, Gorka Guardiola wrote:
> yes, but !older is the same as younger or equal.

yes.

> 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".

Kenji Arisawa




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-11  2:38 ` Russ Cox
@ 2008-09-11 13:51   ` Kenji Arisawa
  0 siblings, 0 replies; 10+ messages in thread
From: Kenji Arisawa @ 2008-09-11 13:51 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
  2008-09-11  0:36 erik quanstrom
@ 2008-09-11  2:38 ` Russ Cox
  2008-09-11 13:51   ` Kenji Arisawa
  0 siblings, 1 reply; 10+ messages in thread
From: Russ Cox @ 2008-09-11  2:38 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

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

as does /bin/mtime.


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [9fans] test command
@ 2008-09-11  0:36 erik quanstrom
  2008-09-11  2:38 ` Russ Cox
  0 siblings, 1 reply; 10+ messages in thread
From: erik quanstrom @ 2008-09-11  0:36 UTC (permalink / raw)
  To: arisawa, 9fans

> > 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
}



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-09-11 13:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-09-10 10:19 [9fans] test command Kenji Arisawa
2008-09-10 13:38 ` ron minnich
2008-09-10 14:16   ` Rodolfo kix García 
2008-09-10 15:21   ` David Leimbach
2008-09-10 15:27     ` Juan Céspedes
2008-09-10 16:15       ` Gorka Guardiola
2008-09-11  0:23         ` Kenji Arisawa
2008-09-11  0:36 erik quanstrom
2008-09-11  2:38 ` Russ Cox
2008-09-11 13:51   ` Kenji Arisawa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).