Mark Dominus on 9 Jan 2004 04:46:02 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] changing stdout in a script


Geoff Rivell <grivell@comcast.net>:
> Can't he just use the command 'script' to do this?  You run that and 
> everything gets logged to a file.  

Because of the way 'script' works, that probably isn't what is wanted.
'script' attaches the program to a pseudo-terminal device, so that
when the program examines its standard output, it thinks it's talking
to the terminal.  All the output that comes out of 'script' is
suitable for the terminal; lines might be terminated with CRLF instead
of just LF; programs like 'man', 'more', and 'ls' thathave different
behavior when talking to files than to terminals will choose their
terminal-talking behavior, which is appropriate for a terminal but not
for a shell script that is actually talking to a file.

'script' is mainly for recording interactive sessions and other
conversations that require a terminal.

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug