help-bash
[Top][All Lists]
Advanced

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

Re: Using Associative Arrays declared in functions


From: michael-franzese
Subject: Re: Using Associative Arrays declared in functions
Date: Tue, 13 Apr 2021 19:24:44 +0200

Using -g works like a gem.

My hat off to you Alex. :)

> Sent: Wednesday, April 14, 2021 at 4:31 AM
> From: "Alex fxmbsw7 Ratchev" <fxmbsw7@gmail.com>
> To: michael-franzese@gmx.com
> Cc: "help bash" <help-bash@gnu.org>
> Subject: Re: Using Associative Arrays declared in functions
>
> 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
> >
> >
> >
> >
>



reply via email to

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