* Re: Files modified after a given date
@ 1999-08-23 8:09 Sven Wischnowsky
1999-08-27 21:51 ` Gabor
0 siblings, 1 reply; 12+ messages in thread
From: Sven Wischnowsky @ 1999-08-23 8:09 UTC (permalink / raw)
To: zsh-users
Bruce Stephens wrote:
> Vincent Lefevre <vincent@vinc17.org> writes:
>
> > On Sun, Aug 22, 1999 at 17:44:45 +0100, Bruce Stephens wrote:
> > > Assuming I'm understanding the question correctly, no. You can (in
> > > 3.1.6, anyway), get files modified since some time relative to the
> > > current time:
> > >
> > > *.c(ms-30)
> > >
> > > expands to C files modified in the last 30 seconds, for example.
> >
> > But I don't want it to be relative to the current time.
>
> In which case, I don't think there's a builtin glob way of doing it.
> You could write a function using the stat module, but I don't think we
> have user-defined glob patterns yet?
>
> zmodload stat; builtin stat -H foo .zshrc; echo $foo[mtime]
>
> prints 934038501, for me.
I've been wishing for this since I added the granularity modifiers for
the a/m/c glob qualifiers. The problem is that we would need to be
able to parse date/time strings, of course, which isn't trivial...
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-23 8:09 Files modified after a given date Sven Wischnowsky
@ 1999-08-27 21:51 ` Gabor
1999-08-27 22:09 ` Bruce Stephens
1999-08-27 22:43 ` Bart Schaefer
0 siblings, 2 replies; 12+ messages in thread
From: Gabor @ 1999-08-27 21:51 UTC (permalink / raw)
To: zsh-users
On Mon, Aug 23, 1999 at 10:09:33AM +0200, Sven Wischnowsky wrote:
#
# Bruce Stephens wrote:
#
# > Vincent Lefevre <vincent@vinc17.org> writes:
# >
# > > On Sun, Aug 22, 1999 at 17:44:45 +0100, Bruce Stephens wrote:
# > > > Assuming I'm understanding the question correctly, no. You can (in
# > > > 3.1.6, anyway), get files modified since some time relative to the
# > > > current time:
# > > >
# > > > *.c(ms-30)
# > > >
# > > > expands to C files modified in the last 30 seconds, for example.
# > >
# > > But I don't want it to be relative to the current time.
# >
# > In which case, I don't think there's a builtin glob way of doing it.
# > You could write a function using the stat module, but I don't think we
# > have user-defined glob patterns yet?
# >
# > zmodload stat; builtin stat -H foo .zshrc; echo $foo[mtime]
# >
# > prints 934038501, for me.
This is what I get
=== gabor $ builtin stat -H foo .zshrc
zsh: attempt to set slice of associative array
zsh: exit 1
=== gabor $ where stat
stat: shell built-in command
# I've been wishing for this since I added the granularity modifiers for
# the a/m/c glob qualifiers. The problem is that we would need to be
# able to parse date/time strings, of course, which isn't trivial...
#
# Bye
# Sven
#
#
# --
# Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-27 21:51 ` Gabor
@ 1999-08-27 22:09 ` Bruce Stephens
1999-08-27 22:43 ` Bart Schaefer
1 sibling, 0 replies; 12+ messages in thread
From: Bruce Stephens @ 1999-08-27 22:09 UTC (permalink / raw)
To: zsh-users
Gabor <gabor@vmunix.com> writes:
> This is what I get
>
> === gabor $ builtin stat -H foo .zshrc
> zsh: attempt to set slice of associative array
> zsh: exit 1
> === gabor $ where stat
> stat: shell built-in command
Oh dear. I'm fairly sure it worked in 3.1.6, and 3.1.6-pws-1 is what
I'm using now. I'm guessing that means it will work in 3.2 (or
whatever the next non-beta release is called). Clearly stat shouldn't
give the error message you're getting---that's just silly.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-27 21:51 ` Gabor
1999-08-27 22:09 ` Bruce Stephens
@ 1999-08-27 22:43 ` Bart Schaefer
1999-08-27 23:44 ` Gabor
1 sibling, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 1999-08-27 22:43 UTC (permalink / raw)
To: Gabor, zsh-users
On Aug 27, 5:51pm, Gabor wrote:
> Subject: Re: Files modified after a given date
> === gabor $ builtin stat -H foo .zshrc
> zsh: attempt to set slice of associative array
That's extremely strange. What do you get in $foo if you use -A instead
of -H ? Are you sure you aren't loading a stat module that's from a
different version/build of zsh?
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-27 22:43 ` Bart Schaefer
@ 1999-08-27 23:44 ` Gabor
1999-08-28 5:00 ` PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date) Bart Schaefer
0 siblings, 1 reply; 12+ messages in thread
From: Gabor @ 1999-08-27 23:44 UTC (permalink / raw)
To: Bart Schaefer, zsh-users
On Fri, Aug 27, 1999 at 10:43:47PM +0000, Bart Schaefer wrote:
# On Aug 27, 5:51pm, Gabor wrote:
# > Subject: Re: Files modified after a given date
# > === gabor $ builtin stat -H foo .zshrc
# > zsh: attempt to set slice of associative array
#
# That's extremely strange. What do you get in $foo if you use -A instead
# of -H ? Are you sure you aren't loading a stat module that's from a
# different version/build of zsh?
Well, I figured it out. I believe this to be a bug, though you
decide. I always set ksharrays since I like 0 based indexing and use
ksh for scripting at work. With ksharrays unset, it works.
=== gabor $ unsetopt ksharrays
=== gabor $ stat -H foo .
=== gabor $ print ${(kv)foo[@]}
blksize 8192 nlink 52 size 3072 rdev 533784 mode 16841 mtime 935797473
inode 127121 blocks 6 device 196614 atime 935797353 uid 1000 link
ctime 935797473 gid 1000
=== gabor $ setopt ksharrays
=== gabor $ stat -H foo .
zsh: attempt to set slice of associative array
zsh: exit 1
=== gabor $
^ permalink raw reply [flat|nested] 12+ messages in thread
* PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date)
1999-08-27 23:44 ` Gabor
@ 1999-08-28 5:00 ` Bart Schaefer
1999-08-28 17:14 ` Gabor
0 siblings, 1 reply; 12+ messages in thread
From: Bart Schaefer @ 1999-08-28 5:00 UTC (permalink / raw)
To: Gabor, zsh-users
On Aug 27, 7:44pm, Gabor wrote:
} Subject: Re: Files modified after a given date
}
} On Fri, Aug 27, 1999 at 10:43:47PM +0000, Bart Schaefer wrote:
} # On Aug 27, 5:51pm, Gabor wrote:
} # > Subject: Re: Files modified after a given date
} # > === gabor $ builtin stat -H foo .zshrc
} # > zsh: attempt to set slice of associative array
} #
} Well, I figured it out. I believe this to be a bug, though you
} decide. I always set ksharrays since I like 0 based indexing and use
} ksh for scripting at work. With ksharrays unset, it works.
Aha. Yes, that's a bug. You can see it more easily with
zsh% setopt ksharrays
zsh% : ${(AA)=foo:=a b c d}
zsh: attempt to set slice of associative array
Here'a patch.
Index: Src/params.c
===================================================================
@@ -1697,9 +1697,14 @@
v = NULL;
}
}
- if (!v)
- if (!(v = getvalue(&t, 1)))
- return NULL;
+ if (!v) {
+ int k = opts[KSHARRAYS]; /* Remember the value of KSHARRAYS */
+ opts[KSHARRAYS] = 0; /* and clear it to avoid special- */
+ v = getvalue(&t, 1); /* case of $array --> ${array[0]}. */
+ opts[KSHARRAYS] = k; /* OK because we can't assign to a */
+ if (!v) /* slice of an association anyway, */
+ return NULL; /* so ANY subscript will be wrong. */
+ }
setarrvalue(v, val);
return v->pm;
}
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date)
1999-08-28 5:00 ` PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date) Bart Schaefer
@ 1999-08-28 17:14 ` Gabor
0 siblings, 0 replies; 12+ messages in thread
From: Gabor @ 1999-08-28 17:14 UTC (permalink / raw)
To: Bart Schaefer, zsh-users
Thanks. It works.
=== zsh-3.1.6 $ Src/zsh
=== zsh-3.1.6 $ stat -H foo .
=== zsh-3.1.6 $ print ${(kv)foo[@]}
blksize 8192 nlink 11 size 1024 rdev 211381 mode 16877 mtime 935722586
inode 47762 blocks 2 device 196614 atime 935860476 uid 1000 link ctime
935722586 gid 7
=== zsh-3.1.6 $
On Sat, Aug 28, 1999 at 05:00:03AM +0000, Bart Schaefer wrote:
# On Aug 27, 7:44pm, Gabor wrote:
# } Subject: Re: Files modified after a given date
# }
# } On Fri, Aug 27, 1999 at 10:43:47PM +0000, Bart Schaefer wrote:
# } # On Aug 27, 5:51pm, Gabor wrote:
# } # > Subject: Re: Files modified after a given date
# } # > === gabor $ builtin stat -H foo .zshrc
# } # > zsh: attempt to set slice of associative array
# } #
# } Well, I figured it out. I believe this to be a bug, though you
# } decide. I always set ksharrays since I like 0 based indexing and use
# } ksh for scripting at work. With ksharrays unset, it works.
#
# Aha. Yes, that's a bug. You can see it more easily with
#
# zsh% setopt ksharrays
# zsh% : ${(AA)=foo:=a b c d}
# zsh: attempt to set slice of associative array
#
# Here'a patch.
#
# Index: Src/params.c
# ===================================================================
# @@ -1697,9 +1697,14 @@
# v = NULL;
# }
# }
# - if (!v)
# - if (!(v = getvalue(&t, 1)))
# - return NULL;
# + if (!v) {
# + int k = opts[KSHARRAYS]; /* Remember the value of KSHARRAYS */
# + opts[KSHARRAYS] = 0; /* and clear it to avoid special- */
# + v = getvalue(&t, 1); /* case of $array --> ${array[0]}. */
# + opts[KSHARRAYS] = k; /* OK because we can't assign to a */
# + if (!v) /* slice of an association anyway, */
# + return NULL; /* so ANY subscript will be wrong. */
# + }
# setarrvalue(v, val);
# return v->pm;
# }
#
# --
# Bart Schaefer Brass Lantern Enterprises
# http://www.well.com/user/barts http://www.brasslantern.com
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-22 18:55 ` Bruce Stephens
@ 1999-08-22 19:26 ` Vincent Lefevre
0 siblings, 0 replies; 12+ messages in thread
From: Vincent Lefevre @ 1999-08-22 19:26 UTC (permalink / raw)
To: zsh-users
On Sun, Aug 22, 1999 at 19:55:27 +0100, Bruce Stephens wrote:
> In which case, I don't think there's a builtin glob way of doing it.
> You could write a function using the stat module, but I don't think we
> have user-defined glob patterns yet?
It would be a good idea.
--
Vincent Lefèvre <vincent@vinc17.org> - PhD student in Computer Science
Web: <http://www.vinc17.org/> or <http://www.ens-lyon.fr/~vlefevre/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, Faits divers insolites, etc.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-22 17:17 ` Vincent Lefevre
@ 1999-08-22 18:55 ` Bruce Stephens
1999-08-22 19:26 ` Vincent Lefevre
0 siblings, 1 reply; 12+ messages in thread
From: Bruce Stephens @ 1999-08-22 18:55 UTC (permalink / raw)
To: zsh-users
Vincent Lefevre <vincent@vinc17.org> writes:
> On Sun, Aug 22, 1999 at 17:44:45 +0100, Bruce Stephens wrote:
> > Assuming I'm understanding the question correctly, no. You can (in
> > 3.1.6, anyway), get files modified since some time relative to the
> > current time:
> >
> > *.c(ms-30)
> >
> > expands to C files modified in the last 30 seconds, for example.
>
> But I don't want it to be relative to the current time.
In which case, I don't think there's a builtin glob way of doing it.
You could write a function using the stat module, but I don't think we
have user-defined glob patterns yet?
zmodload stat; builtin stat -H foo .zshrc; echo $foo[mtime]
prints 934038501, for me.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-22 16:44 ` Bruce Stephens
@ 1999-08-22 17:17 ` Vincent Lefevre
1999-08-22 18:55 ` Bruce Stephens
0 siblings, 1 reply; 12+ messages in thread
From: Vincent Lefevre @ 1999-08-22 17:17 UTC (permalink / raw)
To: zsh-users
On Sun, Aug 22, 1999 at 17:44:45 +0100, Bruce Stephens wrote:
> Assuming I'm understanding the question correctly, no. You can (in
> 3.1.6, anyway), get files modified since some time relative to the
> current time:
>
> *.c(ms-30)
>
> expands to C files modified in the last 30 seconds, for example.
But I don't want it to be relative to the current time.
--
Vincent Lefèvre <vincent@vinc17.org> - PhD student in Computer Science
Web: <http://www.vinc17.org/> or <http://www.ens-lyon.fr/~vlefevre/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, Faits divers insolites, etc.
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: Files modified after a given date
1999-08-22 16:31 Files modified after a given date Vincent Lefevre
@ 1999-08-22 16:44 ` Bruce Stephens
1999-08-22 17:17 ` Vincent Lefevre
0 siblings, 1 reply; 12+ messages in thread
From: Bruce Stephens @ 1999-08-22 16:44 UTC (permalink / raw)
To: zsh-users
Vincent Lefevre <vincent@vinc17.org> writes:
> Is there a way to get the files modified after a given date (as a
> glob qualifier), the date being given as the number of seconds since
> the origin?
Assuming I'm understanding the question correctly, no. You can (in
3.1.6, anyway), get files modified since some time relative to the
current time:
*.c(ms-30)
expands to C files modified in the last 30 seconds, for example.
This is described towards the end of zshexpn(1).
^ permalink raw reply [flat|nested] 12+ messages in thread
* Files modified after a given date
@ 1999-08-22 16:31 Vincent Lefevre
1999-08-22 16:44 ` Bruce Stephens
0 siblings, 1 reply; 12+ messages in thread
From: Vincent Lefevre @ 1999-08-22 16:31 UTC (permalink / raw)
To: zsh-users
Is there a way to get the files modified after a given date (as a
glob qualifier), the date being given as the number of seconds since
the origin?
--
Vincent Lefèvre <vincent@vinc17.org> - PhD student in Computer Science
Web: <http://www.vinc17.org/> or <http://www.ens-lyon.fr/~vlefevre/> - 100%
validated HTML - Acorn Risc PC, Yellow Pig 17, Championnat International
des Jeux Mathématiques et Logiques, TETRHEX, Faits divers insolites, etc.
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~1999-08-28 17:14 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-08-23 8:09 Files modified after a given date Sven Wischnowsky
1999-08-27 21:51 ` Gabor
1999-08-27 22:09 ` Bruce Stephens
1999-08-27 22:43 ` Bart Schaefer
1999-08-27 23:44 ` Gabor
1999-08-28 5:00 ` PATCH: ksharrays and assoc array assignments (was Re: Files modified after a given date) Bart Schaefer
1999-08-28 17:14 ` Gabor
-- strict thread matches above, loose matches on Subject: below --
1999-08-22 16:31 Files modified after a given date Vincent Lefevre
1999-08-22 16:44 ` Bruce Stephens
1999-08-22 17:17 ` Vincent Lefevre
1999-08-22 18:55 ` Bruce Stephens
1999-08-22 19:26 ` Vincent Lefevre
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).