Hi Steffen,

> That is, tr(1) is buggy

tr(1) seems to be behaving as I'd expect.  The \n is a control character
and is being turned into space so you have to add another with echo.  It
thinks 0-0x1f and 0x7f are cntrl.

    $ recode /test8 </dev/null |
    > tr -c '[:cntrl:]' - |
    > tr '[:cntrl:]' c |
    > fold -32; echo
    cccccccccccccccccccccccccccccccc
    --------------------------------
    --------------------------------
    -------------------------------c
    --------------------------------
    --------------------------------
    --------------------------------
    --------------------------------
    $

> This doesn't work in the code above

I can get an additional echo to work here, Linux, so I'm not quite sure
what you're trying that fails?

    $ printf '%s\n' foo '.pso sh -c \' ' "echo -n a | tr a b"' bar |
    > nroff -U | grep .
    foo bbar
    $
    $ printf '%s\n' foo '.pso sh -c \' ' "echo -n a | tr a b; \' ' echo"' bar |
    > nroff -U | grep .
    foo b bar
    $ 

Cheers, Ralph.

Reply via email to