This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Logging all console activity to a text file


Hussein Patwa wrote:

> Thanks for your very detailed post.  I'm no Unix guru so I'll be honest and
> say some of that wasn't entirely clear to me.  It seems that, as what I'm
> doing with cygwin is really pretty basic (compressing/decompressing,
> subversion operations, ssh operations, etc), trying a different shell like
> xterm as you mentioned may be the best and simplest bet.  I doubt at this
> stage of learning I'd even notice the difference.

I think you're confusing the concept of a shell with the concept of a
terminal.  They work together, but they're independent parts.

The shell is the program that interprets what you type at a prompt.  Its
job is to do things like find where on the PATH the program is located
and invoke it, expand wildcards into a list of matching filenames,
redirect input or output if you typed "<" or ">", etc.  The shell has
nothing to do with the physical window that you see on your screen, and
in fact in many cases the shell runs with no terminal at all, such as
when it's given a script file to execute with input and output
redirected, or when it's running a cron job, etc.

Bash is the default Cygwin shell, but there are alternative shells such
as tcsh, zsh, csh, ksh, ash, etc.  The Windows native shell is cmd.exe.

The terminal is the thing that displays characters on the screen, and
interprets keystrokes from the operating system, translating them into
escape sequences that are parsed by whatever is reading input. The
terminal doesn't know anything about what is running inside it, it's
just a device that prints characters to a rectangular box and sends
keystroke sequences.  You can have a terminal with no shell, such as
when you invoke a program directly and it prints to stdout.

The default Cygwin terminal is a Windows Console, and so it's Windows
that draws the box, displays the characters, scrolls the screen, etc. 
Alternative terminals are rxvt and xterm.

As you can see what most people might call a "Cygwin prompt" or "shell
prompt" or a "shell" is really a combination of a shell and a terminal. 
You can mix and match from the above list in any combination: The
default is bash with a Windows Console, but you can use bash+rxvt,
bash+xterm, zsh+Windows Console, zsh+xterm, and on and on.  If you
switched your terminal from a Windows Console to xterm you would still
be using bash, unless you changed that too.  People seem to think that
because they click on that Cygwin icon and the "cygwin.bat" just runs
"bash.exe --login" that the box they see on the screen is drawn and
controlled by bash, but that's not really true.  The operating system
provides that console to bash, which is why it looks exactly like the
console from a standard Windows Command Prompt.

Anyway, using 'script' is really much more simple than switching to
xterm, which is an X11 app which requires installing an X11 server,
etc.  Install the util-linux package, and from the prompt type "script
filename".  Now everything typed and output is written to filename,
until you type exit.

Brian

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]