If you source functions.sh in bash, set verbose=1 and attempt to use info_check Checking something in a terminal that supports colors, you'll see a bunch of escape sequences instead of terminal output codes.
This happens because echo \033 is undefined behavior, according to POSIX. dash interprets it by echoing a single ASCII ESC character, bash prints the four ASCII characters (BACKSLASH ZERO THREE THREE) literally.
printf, which is a shell builtin in both bash and dash, is well-specified and interprets C-style escape sequences. Using it instead of echo would make it possible to make use of functions.sh when /bin/sh is set to bash.
If you source
functions.sh
in bash, setverbose=1
and attempt to useinfo_check Checking something
in a terminal that supports colors, you'll see a bunch of escape sequences instead of terminal output codes.This happens because
echo \033
is undefined behavior, according to POSIX. dash interprets it by echoing a single ASCII ESC character, bash prints the four ASCII characters (BACKSLASH ZERO THREE THREE) literally.printf
, which is a shell builtin in both bash and dash, is well-specified and interprets C-style escape sequences. Using it instead of echo would make it possible to make use of functions.sh when /bin/sh is set to bash.