> The problem is that my MSYS sed was version 3.02, and it did not
> recognise \n in the replacement string when you want to make each funny
> character on one line. I made some test with my git bash --- which has
> sed version 4.2.1 --- and recognising \n is OK
>
Apparently it should be \NEWLINE, where NEWLINE is a newline
character. Quoting is tricky, because \NEWLINE is interpreted as a
line continuation except in single quotes or if the backslash is
escaped. We are in single quotes, but those single quotes are within
backquotes. I avoided this complication by using a function in the
following patch:
--- texi2dvi (revision 7200)
+++ texi2dvi (working copy)
@@ -918,6 +918,13 @@
fi
}
+list_funnies ()
+{
+ echo "$in_input" \
+ | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\
+!g' | uniq
+}
+
# run_tex - Run TeX as "$tex $in_input", taking care of errors and logs.
run_tex ()
{
@@ -926,9 +933,8 @@
# Check for any unusual characters in the filename.
# However, >, \ and any whitespace characters are not supported
# filenames.
- in_input_funnies=`echo "$in_input" \
- | $SED -e 's![^}#$%&^_{~]!!g' -e 's!\(.\)!\1\n!g' \
- | uniq`
+ in_input_funnies=`list_funnies`
+
if test -n "$in_input_funnies" ; then
# Make > an end group character, as it's unlikely to appear in
# a filename.
> Ok, one sh only solution would be to do this :
>
> --8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
> in_input_funnies=`echo "$in_input" \
> | $SED -e 's![^}#$%&^_{~]!!g' \
> | { while IFS= read -r -n1 -d '' c; do printf '%s\n' "$c"; done } \
> | uniq`
> --8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
>
> Hopefully this is portable code ;-) ...
Options to "read" aren't portable AFAIK.