Just because something doesn't follow general rules for readable code, doesn't mean it is actually unreadable.
Just because something doesn't follow general rules for readable code, doesn't mean it is actually unreadable.
I can definitely guess the pattern and I do write bash regularly, but I see at least 2 things I'd need to double-check the man page for the behaviour.
Heck, by this definition i'm not sure any code is really good enough. In my job i have to write php daily, i still need to regularly look at docs to figure out order of arguments for various library functions. I wouldn't be able to tell if explode($a, $b) in php has the right argument order at a glance without looking it up. But i understand the intent and generally assume the superficial aspects of the code are right unless that part appears not to work.
And furthermore, adjusting the number of newlines isn't going to help with the question of if that piece of code is using bash syntax correctly.
Other languages seem to've made things at least somewhat more predictable.
(and then, being software, suck in different ways of course)
Perl gets a lot of flak for being unreadable, but I personally have more difficulty understanding bash code than perl (not implying that perl is super readable).
if [[ $OPTION =~ = ]]
then
declare "BOCKER_${OPTION/=*/}=${OPTION/*=/}"
else
declare "BOCKER_${OPTION}=x"
fi
Going from here, if you rewrite this in golang you'd probably improve readability.But the readability has not been "thrown out of the window" yet, like in this case:
[[ $OPTION =~ = ]] && declare "BOCKER_${OPTION/=*/}=${OPTION/*=/}" || declare "BOCKER_${OPTION}=x"Yeah, that was unnecessary. Ironically now I remember that I was once frustrated by someone who was using Boolean logic to emulate if/else in Python.