News for hackers. Stuff that matters.
Re:Pure Bash Bible by cblades on Thursday September 19, 2019 @09:51AM (#21016129)
Maybe "unreadable" and "readable" aren't the best ways to approach this conversation.

It's certainly less readable than, say, my_str.strip()

Re:Pure Bash Bible by joombaga on Thursday September 19, 2019 @11:01AM (#21016823)
Are you comparing a call to a definition? `trim_string "$my_str"` is no less readable than `my_str.strip()`.
Re:Pure Bash Bible by mankyd on Thursday September 19, 2019 @12:23PM (#21017732)
I mean, I would say it is. Why are there quotes around the variable? What happens when I remove the quotes?

The quotes don't function like the parens. If this were a two argument function, you wouldn't put one pair of quotes around the whole thing. They're clearly transforming the variable somehow, but I'm not sure how and/or why they're necessary.

Re:Pure Bash Bible by serhart on Thursday September 19, 2019 @09:56AM (#21016187)
Sure, but bash only has certain language constructs. This implementation is using parameter expansion and some other built ins. It's definitely more complex than yours, but that's what bash has to offer.