Follow

There are times when I really question my choice to do things in shellscript. Did you know that in BSD /bin/sh and in Bash, variables inside "for" loops are global like normal, but variables inside "while" loops are automatically local to the loop? I didn't, and I wasted about an hour fruitlessly debugging everything because of it.

Specifically, "while" loops on the receiving end of a pipe. Variables are local because the loop is executed in a subshell. Oops.

Sign in to participate in the conversation
Computer Fairies

Computer Fairies is a Mastodon instance that aims to be as queer, friendly and furry as possible. We welcome all kinds of computer fairies!