bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cannot redirect $RANDOM


From: mw
Subject: Cannot redirect $RANDOM
Date: 7 Nov 2000 20:00:59 -0000

Configuration Information [Automatically generated, do not change]:
Machine: i386
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='i386' 
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='i386-redhat-linux-gnu' 
-DCONF_VENDOR='redhat' -DSHELL -DHAVE_CONFIG_H  -D_GNU_SOURCE 
-D_FILE_OFFSET_BITS=64  -I.  -I. -I./include -I./lib -I/usr/include -O2 
-march=i386 -mcpu=i686
uname output: Linux thales.memphis.edu 2.2.16-22 #1 Tue Aug 22 16:49:06 EDT 
2000 i686 unknown
Machine Type: i386-redhat-linux-gnu

Bash Version: 2.04
Patch Level: 11
Release Status: release

Description:
        I cannot pipe/redirect certain expressions involving RANDOM

        For example,

        I always get the deterministic

        $ RANDOM=1; echo $RANDOM
        32422

        but I get random output if I try to pipe the output

        $ { RANDOM=1; echo $RANDOM; } | cat -
        10843
        $ { RANDOM=1; echo $RANDOM; } | cat -
        5538

        Under bash1, I still get the deterministic output:

        $ { RANDOM=1; echo $RANDOM; } | cat -
        16838

        The only way I could make this work with bash2 is to do

        $ sh -c  'RANDOM=1; echo $RANDOM' | cat -
        32422

Thx for any enlightment,

Mate Wierdl



reply via email to

[Prev in Thread] Current Thread [Next in Thread]