Kinda cool, I don’t write or read much bash and tend to stick to sh compatible stuff.
There are some neat tricks in here but they don’t seem very readable compared to perl/awk/sed.
There are some neat tricks in here but they don’t seem very readable compared to perl/awk/sed.
``` trim_string() { # Usage: trim_string " example string " : "${1#"${1%%[![:space:]]}"}" : "${_%"${_##[![:space:]]}"}" printf '%s\n' "$_" } ```
and think: "I should use bash more".
Bash is nice for making simple things simple but for complicated things it's just shitty. I used to think that this is due to the complicated quoting rules which make the simple things simple but tcl does a much better job at that.
In either case I prefer the clean rules of a Python or Perl for anything larger.