From owner-freebsd-questions@FreeBSD.ORG Tue Feb 28 15:05:58 2006 Return-Path: X-Original-To: questions@freebsd.org Delivered-To: freebsd-questions@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D58CF16A420 for ; Tue, 28 Feb 2006 15:05:58 +0000 (GMT) (envelope-from jimmy@jamesbailie.com) Received: from smtp100.rog.mail.re2.yahoo.com (smtp100.rog.mail.re2.yahoo.com [206.190.36.78]) by mx1.FreeBSD.org (Postfix) with SMTP id 4F43C43D46 for ; Tue, 28 Feb 2006 15:05:57 +0000 (GMT) (envelope-from jimmy@jamesbailie.com) Received: (qmail 91929 invoked from network); 28 Feb 2006 15:05:54 -0000 Received: from unknown (HELO ?70.29.126.205?) (jazzturk@rogers.com@70.29.126.205 with plain) by smtp100.rog.mail.re2.yahoo.com with SMTP; 28 Feb 2006 15:05:52 -0000 Message-ID: <440466CF.2000007@jamesbailie.com> Date: Tue, 28 Feb 2006 10:05:51 -0500 From: James Bailie User-Agent: Mozilla Thunderbird 1.0.7 (X11/20051218) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Glenn Dawson References: <7.0.1.0.2.20060228112857.0035f998@broadpark.no> <7.0.1.0.2.20060228025256.039d9f68@antimatter.net> In-Reply-To: <7.0.1.0.2.20060228025256.039d9f68@antimatter.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: questions@freebsd.org Subject: Re: script(1) > Why does it output in CR/LF? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2006 15:05:58 -0000 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 http://www.jamesbailie.com