[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[50 character or so descriptive subject here (for reference)]
From: |
Al Elgert |
Subject: |
[50 character or so descriptive subject here (for reference)] |
Date: |
Mon, 14 Jan 2002 16:18:04 +0100 (MET) |
Configuration Information [Automatically generated, do not change]:
Machine: sparc
OS: solaris2.7
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='sparc'
-DCONF_OSTYPE='solaris2.7' -DCONF_MACHTYPE='sparc-sun-solaris2.7'
-DCONF_VENDOR='sun' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib
-I/usr/local/include -g -O2
uname output: SunOS ultra12 5.7 Generic_106541-17 sun4u sparc SUNW,Ultra-2
Machine Type: sparc-sun-solaris2.7
Bash Version: 2.05
Patch Level: 0
Release Status: release
Description:
There are two Problems:
1. environment variables are not able to override local function variables
affects bash2.05
2. 0x1 (Start Of Heading) cannot be passed to a function via $1 (but $@
can)
affects bash2.04, bash2.05
Repeat-By:
consider this function with local variables:
bash-2.05$ function fff() { local i=0 x=10; echo "|$i|$x|"; }
bash-2.05$ fff
|0|10|
bash-2.05$ x=10 fff
|0||
bash2.04 reacts as expected:
bash2.04.0-2.04$ function fff() { local i=0 x=10; echo "|$i|$x|"; }
bash2.04.0-2.04$ fff
|0|10|
bash2.04.0-2.04$ x=10 fff
|0|10|
And now consider this function:
bash-2.05$ function fff() { local i=0 x; x=10; echo "|$i|$x|"; }
bash-2.05$ fff
|0|10|
bash-2.05$ x=1 fff
|0|10|
bash2.04:
bash2.04.0-2.04$ function fff() { local i=0 x; x=10; echo "|$i|$x|"; }
bash2.04.0-2.04$ fff
|0|10|
bash2.04.0-2.04$ x=1 fff
|0|1|
bash2.05 does not allow to override local variables, it completelely drops the
local Variable, making the function unable to work correctly.
2.)
-----------------------------------------------------------------------------
The $# Variable show, in any of these two cases one argument:
bash-2.05$ function huhu() { echo "$#"; }; huhu $(echo -en "\1")
1
bash-2.05$ function huhu() { echo "$#"; }; huhu $(echo -en "\2")
1
The $@ Variable shows the both Strings correctly:
bash-2.05$ function huhu() { echo "$@"; }; huhu $(echo -en "\1") | xxd
0000000: 010a ..
bash-2.05$ function huhu() { echo "$@"; }; huhu $(echo -en "\2") | xxd
0000000: 020a ..
But $1 does not:
bash-2.05$ function huhu() { echo "$1"; }; huhu $(echo -en "\1") | xxd
0000000: 0a .
bash-2.05$ function huhu() { echo "$1"; }; huhu $(echo -en "\2") | xxd
0000000: 020a ..
[50 character or so descriptive subject here (for reference)], elk, 2002/01/21
[50 character or so descriptive subject here (for reference)], benchoff, 2002/01/25
Re: [50 character or so descriptive subject here (for reference)], Chet Ramey, 2002/01/28