[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[50 character or so descriptive subject here (for reference)]
From: |
Jim Thomas |
Subject: |
[50 character or so descriptive subject here (for reference)] |
Date: |
Wed, 5 Dec 2001 17:02:04 -1000 (HST) |
Configuration Information [Automatically generated, do not change]:
Machine: hppa1.1
OS: hpux10.20
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='hppa1.1'
-DCONF_OSTYPE='hpux10.20' -DCONF_MACHTYPE='hppa1.1-hp-hpux10.20'
-DCONF_VENDOR='hp' -DSHELL -DHAVE_CONFIG_H -DHPUX -I. -I. -I./include
-I./lib -I/usr/local/include -g -O2
uname output: HP-UX atlas B.10.20 A 9000/712 2007201070 two-user license
Machine Type: hppa1.1-hp-hpux10.20
Bash Version: 2.05
Patch Level: 0
Release Status: release
Description:
Continuing with trying to hide the differences between HP's "POSIX"
shell and bash, using the previous suggestion, my function still fails. It
appears that the variable I declare in the function is not made global.
The equivalent "set -A $ArrayName $*" in HP's shell does return a value for
pwdArray whether it is executed directly or is stuffed in Command and eval'ed
as with the function below. I read the FUNCTIONS section of bash.1 to
indicate that my declare should not be local.
Repeat-By:
With the following in bash.bash :
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
SetArray () {
local ArrayName Command
echo sa start =$*=
ArrayName=$1
shift
echo sa name =$ArrayName=
echo sa rest =$*=
Command="declare -a $ArrayName=($*)"
echo sa com =$Command=
eval "$Command"
echo sa array =${pwdArray[*]}=
}
typeset pwdArray
SetArray pwdArray h thomas
echo after array =${pwdArray[*]}=
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
atlas ~ > /usr/local/src/gnu/bash-2.05/bash
bash-2.05$ . bash.bash
sa start =pwdArray h thomas=
sa name =pwdArray=
sa rest =h thomas=
sa com =declare -a pwdArray=(h thomas)=
sa array =h thomas=
bash-2.05$ . bash.bash
sa start =pwdArray h thomas=
sa name =pwdArray=
sa rest =h thomas=
sa com =declare -a pwdArray=(h thomas)=
sa array =h thomas=
after array ==
bash-2.05$
- [50 character or so descriptive subject here (for reference)],
Jim Thomas <=