How to print “-n”, “-e” or “-neeenen” from bash (without a newline at the end, without invoking of external programs)?
Q="-n"
echo -n "$Q" # fail
echo -- "$Q" # fail
cat <<< "$Q" # fail, also starts external program
printf -- '%s' "$Q" # success, but starts external program
In bash,
printfis a builtin, so no external program is invoked.