zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: du(1) completion and a little $RANDOM problem
Date: Wed, 16 Jul 2003 12:30:09 +0100	[thread overview]
Message-ID: <752.1058355009@csr.com> (raw)
In-Reply-To: "Guillaume Chazarain"'s message of "Wed, 16 Jul 2003 13:16:31 +0200." <WMLXW933VXMGWU3V62QML52GE5YB7.3f15340f@monpc>

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@csr.com>                  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.
**********************************************************************


  reply	other threads:[~2003-07-16 11:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-16 11:16 Guillaume Chazarain
2003-07-16 11:30 ` Peter Stephenson [this message]
2003-07-16 11:46   ` Bart Schaefer
2003-07-16 12:09     ` Sven Wischnowsky
2003-07-17 10:17     ` Oliver Kiddle
2003-08-20 10:35   ` PATCH: " Oliver Kiddle
2003-08-20 14:22     ` Doug Kearns
2003-08-21 12:35       ` Oliver Kiddle

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=752.1058355009@csr.com \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).