2 ms·
Your shell thing is honestly fine. The emoji thing was a joke, sorry that wasn’t clear. The thing is with 1 IP lookup in N addresses a grep is also fine, but
by gorgoiler 5y ago
Your shell thing is honestly fine. The emoji thing was a joke, sorry that wasn’t clear.
The thing is with 1 IP lookup in N addresses a grep is also fine, but with M IP lookups the set is O(1) instead of O(N) and that makes a difference.
It’s not just theoretical. Bash slowness adds up fast and you will need to upgrade to a real language anyway.
Example: IPv6 addresses need to be truncated to /64 but last prints them with 0 truncation. Good luck doing that in bash. You’ll need a fully fledged IPv6 address parser, if it’s code that has to survive.
You make a fine point, honestly, about what you can get away with in shell scripting. The bigger picture is that literally nothing ever survives the sticky fingers if many engineers over time if it is a shell script. It gets worse and worse until it is ported, at which point it begins a new life as maintainable code.
Bash is a shell. Not a programming language.