Drive rdbg tests in a more portable way
Tests using rdbg simulate user input by piping
echo output to rdbg, eg. in
rdbg_test: ring.ml echo "\nnr\nsd\nq\n" | rdbg -o ring.rif -l 10000 -sut "$(sasa) -vl 1 ring.dot -dd"
But this is not portable as we are using escaped characters:
It is not possible to use echo portably across all POSIX systems unless both -n (as the first argument) and escape sequences are omitted.
In fact, in my own machine the command above causes rdbg to interpret "\nnr\nsd\nq\n" as a single user input, yielding the error
invalid key (\nnr\nsd\nq\n), try again
Posix suggests using
New applications are encouraged to use printf instead of echo.