1
3
Ballig

@programming.dev

Ballig 1 point 3 years ago

The return value is either 0 or 1.

I don't know enough about coding to know what a variable's scope is. *SearXNG noises* You might be onto something. You think the function is being piped into a subshell?

Brackets didn't seem to help in my script; although maybe I should make a smaller test script just to rule out incompetence. (I'm guessing on the proper syntax for that, something like if ! [[ $(name_of_function "$arguments") ]] ; then, yes?)

I've tried both versions. name_of_array=() in or out of the function, also declare -a -g name_of_array, if I'm remembering those arguments right, at the top of the script.

Thanks for indulging my curiosity; I appreciate it.

path: 0 7928058 7928728, hotness: undefined, score: 1, children: 0
Ballig 1 point 3 years ago

I've never used pastebin or similar services, but if you feel like wading through my mess of a coding playground, the offending code is when findclosestbox calls either collisiondetection or findbetterport, and the debug "echo" I'm interested in is the one after "This is the end of the findclosestbox function:"

https://zerobin.net/...

password: lemmydebug

path: 0 7928617 7929638, hotness: undefined, score: 1, children: 0
Ballig 1 point 3 years ago

I went ahead and put the same command on either side of an if/else just to make sure I wasn't messing up the return value. These results are interesting though; I suppose that means I just made an unrelated mistake somewhere. Incompetence is completely plausible in this case.

Edit: Wait though, now my script works, but all I did was expand the if statement into name_of_function, return_variable=$?, and if ! [[ return_variable ]]; then. I didn't screw anything else up. So the mystery remains.

path: 0 7928617 7928858, hotness: undefined, score: 1, children: 0

thanks for using Leebra!

go to feed...