[msg(shbot)] # foo() { declare -a foo=( "$@" ) ; declare i=-1 ; declare -p
foo ; declare -n next=foo[++i]
now=foo[i] ; while [[ -v next ]] ; do : $now ; done ; printf -- $i ; } ;
foo '' 1 2 3
[shbot(~shbot@37.139.2.101)] declare -a foo=([0]="" [1]="1" [2]="2" [3]="3")
[shbot(~shbot@37.139.2.101)] -
oh i see, a bit of my fault, me noob with web mail and mailing lists
im sorry
i hope for better up soon
On Mon, Mar 8, 2021 at 2:33 AM Eli Schwartz wrote:
> On 3/7/21 8:24 PM, Alex fxmbsw7 Ratchev wrote:
> > and as last note to end this thread:
> There is no thread.
>
> There are, in fact, four
yea well i posted in a later post, locally declared vars are empty excepts
they are given on the function calling line, just like local vars, hm
the different names is not so a good idea but ill think
thank you much anyway :))
On Mon, Mar 8, 2021 at 2:25 AM Greg Wooledge wrote:
> Alex fxmbsw7 R
On 3/7/21 8:24 PM, Alex fxmbsw7 Ratchev wrote:
> and as last note to end this thread:
There is no thread.
There are, in fact, four threads. I suspect you're using gmail.com's web
client (??), which does not generate working emails many times.
Specifically, for whatever reason, all your emails are
Alex fxmbsw7 Ratchev (fxmb...@gmail.com) wrote:
> bash-5.1# cat int.fail
> int() {
> declare -a int
You've declared a local array named "int" which has nothing in it.
This is inside a function named "int".
> declare i=-1 now
>
> while [[ -v int[++i] ]] && now=${int[i]} ; do
> printf %s\\n
and as last note to end this thread:
var=foo func
leaves 'declare var ;' inside func be still 'foo'
while
var=foo ; func
does make it empty
peace, thanks, swfun
i thought i tested, to 'shadow' the array to local to make it expandable in
the function
but it seems its empty
so declare -a arr=( "${arr[@]}" )
as is otherwise empty
any better idea ?
this is what i tried to achieve, but right it still fails:
# foo=( 0 1 2 ) i=-1 ; while [[ -v foo[++i] ]] ; do : ; done ; printf
$i
ogt: 3
just in functions not .. .. ?
i usually interate thru indexed arrays as, i=-1, while [[ -v arr[++i] ]],
but it suddenly stopped
maybe cause i switched to in-functions than aliases use
bash-5.1# cat int.fail
int() {
declare -a int
declare i=-1 now
while [[ -v int[++i] ]] && now=${int[i]} ; do
printf %s\\n "$now"
done
}