Why I Use Printf Over Echo

While echo is the more widely known command for printing text to standard out, I have found behavior and documentation inconsistencies in its varying implementations1. macOS echo man page: Ubuntu echo man page: In addition, it’s default behavior can cause unintended results when combined with character sensitive commands like base64. Here are a few use cases where echo has caused some trouble for me. Base64 encoding credentials to put into secret management (Hashicorp Vault, kubernetes, etc....

November 17, 2021 · 1 min