Re: script(1) > Why does it output in CR/LF?



Glenn Dawson wrote:

> At 02:30 AM 2/28/2006, Kristian Vaaf wrote:
>
>> Hello.
>>
>> I am just curious why the files I generate with script(1) output in CR/LF
>> forcing me to run dos2unix on them everytime?
>
>
> Script just captures the output of your shell, and your shell has to
> send crlf in order to get the cursor back to the beginning of a line.

No it doesn't. The script(1) utility interposes a
pseudo-terminal between the program whose output is to be
captured and itself, so the program thinks its running on a
terminal device and behaves accordingly. Then script(1) acts
like a transparent filter, shuttling data back-and-forth from the
actual terminal to the pseudo-terminal, while sending a copy of
the program's output to the log file as well. It is the terminal
driver in canonical mode, "inside" the pseudo-terminal, that is
expanding NLs in the proggy's output stream into CRNL pairs.

--
James Bailie <jimmy@xxxxxxxxxxxxxxx>
http://www.jamesbailie.com
_______________________________________________
freebsd-questions@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: script(1) > Why does it output in CR/LF?
    ... At 16:05 28.02.2006, James Bailie wrote: ... >> forcing me to run dos2unix on them everytime? ... > Script just captures the output of your shell, ...
    (freebsd-questions)
  • Re: script(1) > Why does it output in CR/LF?
    ... in CR/LF forcing me to run dos2unix on them everytime? ... Script just captures the output of your shell, ... you're emailing the list from a windows box. ...
    (freebsd-questions)
  • Re: Subprocess with and without shell
    ... command when it runs through the shell but not without it. ... # this captures both stdout and stderr as expected ... but the specific executable being spawned is not a python ...
    (comp.lang.python)
  • Re: shared care
    ... shell wrote: ... or would this cause conflict between him and his mother? ... There must be some way of forcing them to acknowledge he does stay ...
    (uk.gov.agency.csa)
  • Re: Subprocess with and without shell
    ... command when it runs through the shell but not without it. ... # this captures both stdout and stderr as expected ... If run a command via an interactive shell and it behaves differently ...
    (comp.lang.python)