github TekWizely/bash-tpl v0.8.0
Posix-Compatible Text Escaping [ Breaking Change ] - v0.8.0

17 days ago

Bash-TPL

A Smart, Lightweight shell script templating engine, written in Bash.

Release - v0.8.0

Previously, Bash-TPL used bash's printf -q "string" technique to escape text strings. I was not aware that the $'' string-encoding is not posix and is not supported on many shells.

User @0xEAB encountered a bug when trying to run scripts that contained escaped TABS within Dash:

  • Generated dollar-quote escape sequences are Bash-specific (in practice) #25

After some research, I learned that the posix-compatible way to print strings with escape sequences is %b.

Bash-TPL now utilizes a new encoding technique and uses %b to print text line strings.

Full Changelog: v0.7.1...v0.8.0

Breaking Changes

Technically this is a breaking change as Bash-TPL now generates vastly different looking printf statements the previous versions.

Example of Changes

Below is an example of encoding outputs before / after this change:

tabs.tpl

one	two	three

output from v0.7.1

printf "%s\n" $'one\ttwo\tthree'

output from v0.8.0

printf "%b\n" 'one\ttwo\tthree'

No Negative Impact Expected

In practice, I don't expect there to be any negative impact from the change, but please do create an issue if something doesn't work for you.

Don't miss a new bash-tpl release

NewReleases is sending notifications on new releases.