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

Re: du(1) completion and a little $RANDOM problem



Guillaume Chazarain wrote:
> Hi list,
> 
> Zsh's default completion on the du(1) command is to show only the
> directories, but why? since du can also be used on files.

It probably deserves it's own completion.  Note if you have GNU du you
can:

compdef _gnu_generic du

for best results.  (I wonder if we could autodetect or at least guess
some of these at startup where guessing wrong isn't too painful?)

> But if I do echo `echo $RANDOM` then the random value is always the same.

This is documented in the manual entry.

     RANDOM <S>
          A pseudo-random integer from 0  to  32767,  newly  gen-
          erated  each  time  this  parameter is referenced.  The
          random number generator can be seeded  by  assigning  a
          numeric value to RANDOM.

          The values of RANDOM form  an  intentionally-repeatable
          pseudo-random sequence; subshells that reference RANDOM
          will result in identical  pseudo-random  values  unless
          the  value  of  RANDOM  is  referenced or seeded in the
          parent shell in between subshell invocations.

The workaround is to refer to it in the current shell between
invocations.  The only other fix would be some communication with the
subshell.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************



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