Linux Smart Enumeration 2.0: POSIX edition

[blog poststandalone]

There have been several tickets related in one way or another with POSIX compatibility. There were problems with the script not executing under dash, having errors in old bash versions, etc.

I did not think about migrated it to POSIX compliance because I was using data structures like arrays and other handy features that new bash versions have but they are not available under the POSIX standard.

However I decided to take a look to see how hard can it be... and it was way easier than I though. Nevertheless it took some creativity to simulate arrays and to workaround other issues.

I also found some tools that help to diagnose problems in the scripts, like shellcheck, which is a shell linting program or posh the Policy-compliant Ordinary SHell. Now Linux Smart Enumeration runs in posh!

There are still some minor things that are still not 100% POSIX but they seem to be very well supported across different shells and versions. One of them, for example is the use of local reserved word to define local variables.

All in all I regret not having tried this migration before and I am very happy that it is working now.

You can now try the mostly POSIX compliant and updated version 2.0 of Linux Smart Enumeration.