Some posix-compliant shell functions which you may find useful

These are select functions from my main project (geoip-shell) which can be used standalone.
This part implements lists and strings manipulation, mostly written in native shell code (so for short input works much faster than calling external binaries).

https://github.com/friendly-bits/posix-lists-and-strings

3 Likes

update:

  • added the missing trim_IFS variable assignment
  • updated field separator var name in get_difference() to a more unique name to avoid collisions
  • turns out get_difference() had a bug with output which I also fixed
  • updated num2human() to properly convert input other than bytes
1 Like

added a new function - add2list(). super useful and makes the code dealing with lists cleaner and shorter.