[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
array unchanged when output of function is piped with '|'
From: |
Arnulf Striepecke |
Subject: |
array unchanged when output of function is piped with '|' |
Date: |
Mon, 19 Nov 2001 19:50:37 +0100 (MET) |
Machine: sparc
OS: solaris2.6
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DHOSTTYPE='sparc'
-DOSTYPE='solaris2.6' -DMACHTYPE='sparc-sun-solaris2.6' -DSHELL
-DHAVE_CONFIG_H
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -I. -I.
-I./lib -g -O2
uname output: SunOS highwayman.bn1.dsh.de 5.6 Generic_105181-15 sun4u sparc
SUNW,Ultra-250
Machine Type: sparc-sun-solaris2.6
Bash Version: 2.05/2.02
Patch Level: 1/0
Release Status: release
Hope all this helps:
Description:
Changing a global array in a function, where it is exported
as well, has no effect
on array's values if the output of that function is piped
with '|'
Just try the following script with piping the output of function sub
and
without piping:
Repeat-By:
#!/usr/local/bin/bash
declare -a ar
sub() {
ar=('a b c d')
export ar
}
ar=('bbb bbb')
echo $ar
sub | tee s
echo $ar
exit
--
GMX - Die Kommunikationsplattform im Internet.
http://www.gmx.net
- array unchanged when output of function is piped with '|',
Arnulf Striepecke <=