[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using Associative Arrays declared in functions
From: |
Alex fxmbsw7 Ratchev |
Subject: |
Re: Using Associative Arrays declared in functions |
Date: |
Tue, 13 Apr 2021 18:31:30 +0200 |
try -g for declare to have it outside function available
On Tue, Apr 13, 2021, 18:07 <michael-franzese@gmx.com> wrote:
> Am trying to ran some tests on some bash code.
>
> Here is how I run my test
>
> cd fractr-test
> ./colr-test.sh
>
> and this is what I get
>
> termi-colr-wheel: * 79
> colr-test: ***
> Here is colr-fractr.sh
> colr-test: ***
> scout-terminfo-colours: **
>
> For some reason I do still do not understand, I do not get the number 79
> next to the double and triple stars.
>
> Here is the code
>
> ./colr-tools.sh
> termi-colr-wheel ()
> { declare -rA tis=([cols]="$(tput cols)")
> echo "* ${tis[cols]} }
>
> ./fractr-test/colr-fractr.sh
> scout-terminfo-colours {echo "** ${tis[cols]}"}
>
> ./fractr-test/colr-test.sh
> tools_path=$(readlink -f "$0")
> tools_path="${tools_path%/*}"
> tools_path="${tools_path%/*}"
>
> source ${tools_path}/colr-tools.sh
>
> termi-colr-wheel
> echo "colr-test: *** ${tis[cols]}"
>
> source ./colr-fractr.sh
> echo "colr-test: *** ${tis[cols]}"
> scout-terminfo-colours
>
>
>
>
- Calling function from various files, michael-franzese, 2021/04/12
- Re: Calling function from various files, Lawrence Velázquez, 2021/04/12
- Re: Calling function from various files, Eduardo Bustamante, 2021/04/12
- Using Associative Arrays declared in functions, michael-franzese, 2021/04/13
- Re: Using Associative Arrays declared in functions,
Alex fxmbsw7 Ratchev <=
- Re: Using Associative Arrays declared in functions, michael-franzese, 2021/04/13
- Re: Using Associative Arrays declared in functions, Alex fxmbsw7 Ratchev, 2021/04/13
- Re: Using Associative Arrays declared in functions, michael-franzese, 2021/04/13
- Re: Using Associative Arrays declared in functions, Alex fxmbsw7 Ratchev, 2021/04/13
- Re: Using Associative Arrays declared in functions, michael-franzese, 2021/04/13
- Re: Using Associative Arrays declared in functions, Alex fxmbsw7 Ratchev, 2021/04/13