doc/gen-man.sh: use printf instead of echo to make it portable

printf is recommended instead of echo because it has a more predictable
behavior than echo (tip from the POSIX standard ;-). Using it allow us
to generate the _same_ manpage using sh, dash or bash.
This commit is contained in:
Carlos Henrique Lima Melara 2023-06-09 21:23:52 -03:00 committed by Felix Queißner
parent 56ed84a1b4
commit 4308819b9d
1 changed files with 3 additions and 3 deletions

View File

@ -55,12 +55,12 @@ gem_in=$(
# First expression replaces all [Text like this] with bold text.
# Second expression replaces text like *This* or _this_ with italic text.
sed -E \
-e 's#\[([^]]*)\]#\\\\fB\1\\\\fR#g' \
-e 's#(^|[.,!? ]+)[*_]([^*_ ]+[^*_]+[^*_ ]+)[*_]($|[.,!? ])#\1\\\\fI\2\\\\fR\3#g'
-e 's#\[([^]]*)\]#\\fB\1\\fR#g' \
-e 's#(^|[.,!? ]+)[*_]([^*_ ]+[^*_]+[^*_ ]+)[*_]($|[.,!? ])#\1\\fI\2\\fR\3#g'
)
# Convert gemtext to man format
echo "$gem_in" | "$gemtext_converter" >> "$man_output"
printf "%s" "$gem_in" | "$gemtext_converter" >> "$man_output"
# Write the tail to the output file.
cat "$man_tail" >> "$man_output"