Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

RE: Style question: Can this be written in a more elegant way?



> I think you mean:
> 
>     file=( X*(Nom[1]) )
>     (( $+file )) && PROG_SUCCESS $file || PROG_FAIL
> 
> However, that will run PROG_FAIL if PROG_SUCCESS fails, as well as if
> there are no matching files.  I don't think you can avoid if/else.
> 
>     if (( $+file )); then PROG_SUCCESS $file; else PROG_FAIL; fi
> 
> Note that in the event that there are two or more files with the same
> time stamp, there's no guarantee which one of them is chosen, and in
> fact X*(om[1]) and X*(Om[1]) might both choose the same file.

Thank you. This ambiguity would not be a problem in my case. Just out of
curiosity:

[OT] How exact are time stamps on files? If, basically, a time_t value
is choosen
for a time stamp, then in practice the only possibility for two files to
come
up with the same time stamp, is when the time stamp is explicitly
supplied
via "touch", isn't it?

Ronald
-- 
Ronald Fischer (phone +49-89-63676431)
mailto:mn-pg-p-e-b-consultant-3.com@xxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author