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

Re: globbing with interposition

Bart Schaefer wrote:
> For bizarre reasons I don't immediately understand, the following does
> what you want, but probably isn't guaranteed to keep working in future
> releases:
>     mutt eric fotos*(e:'reply=($REPLY -a)':od) -s "all images attached"

od doesn't sort at all, which is sort of implied by:

    if d, files in subdirectories appear before  those
    in the current directory at each level of the search --- this is
    best combined with other criteria, for example `odon' to sort on
    names  for files within the same directory

The effect of "not sorting at all" is likely to be that the files are
read in inode order, except it's not documented how they are likely to
be inserted into the final list.  It does seem that they're reversed on

  % touch a b c d
  % print *(od)
  d c b a
  % rm b
  % touch e
  % print *(od)
  d c e a

The reversal is not an effect of the (od) itself, which simply returns a
the difference of the number of slashes in the file, i.e. zero.  It
looks like it's a side effect of qsort when two files compare equal.
The qsort documentation says:

    The relative order in the output of two items  that  compare
    as equal is unpredictable.

Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070

This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.


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