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

Re: MiNT bug



   >On Fri, Mar 27, 1998 at 11:41:10PM -0500, Martin-Eric Racine wrote:
   >>  Notice in my first post that I *do* ask wether MiNT itself or
   >>the shell is the one supposed to support this. Also, while TCSH
   >>has an extensive (maybe even excessive?) MAN page, BASH doesn't
   >>provide much in term of docs or shell feature, if the manual is
   >>any indication.
   >
   >Say *whaaaaat*??!!  For as long as I can remember, bash has had an
   >extremely long man page, and it also comes with a lot of supplementary
   >documents detailing its features.

  After more MAN reading, it seems BASH is better suited to 
  processing scripts than acting as a login shell, given the
  few commandline options.

  TCSH has a simple '%B bold text here %b' method of outlining 
  bold text in the commandline, which is listed among available
  variables for 'prompt' but there's no equivalent under BASH.

  This is one of many things I've been trying to accomplish on
  BASH, which is supposedly better and more flexible than TCSH,
  but currently without any success.

  Note I'm not gonna BASH this shell because of oversights on
  the commandline front, but then again spending a whole day
  parsing through books and MAN pages only to realize BASH is
  not well-suited for this kind of purpose is frustrating, to
  say the least. 

  Adding my impression that some people on this mailing have 
  an attitude of "newbies suck; we only want unix gurus' is
  not making this any easier either.  My background does NOT
  include studies in Computer Sciences, so sometimes things
  that seem obvious to others aren't so clear to me.

  However, I enjoy learning about this... byte by byte! 8^)

Well, what you've just now discovered is something that's common
knowledge for Unix users. Of course in the beginning there was
only the Bourne shell. BASH is GNU's Bourne-Again-Shell - while
it has a few extensions, it is primarily intended to be a clone
of /bin/sh. These days, very few people use Bourne shell as an
interactive shell, because its rather feature-poor in this area.
But, it is *always* used for writing shell scripts - Bourne shell
is the lowest-common-denominator on Unix systems; you should always
be able to execute a Bourne shell script just about anywhere. It is
also the smallest shell around (i.e., feature-poor on purpose) and
executes the fastest. (Of course, some systems like SCO and AIX
still manage to get it wrong, and their Bourne Shell is too broken
to handle many common scripts, forcing you to either install BASH,
or try again using Korn Shell, which does not always interpret things
with exactly the same effect...)

The C-Shell was written (at Berkeley) specifically because the Bourne
shell wasn't much fun as an interactive shell. The C-shell has
control-flow constructs, for use in scripting, but for the most part
writing scripts in anything other than Bourne shell is discouraged.
(Too non-portable.) The T-Csh was basically an update to C-Shell to
make it even more powerful for interactive use, adding more built-in
functions that people used to fudge using aliases and the like. It's
important to note that Bourne Shell and its derivatives uses a much
different syntax than C-Shell and its derivatives. While they share
many concepts in common, their syntax is largely incompatible.

Something else to note, which is relevant to the beginning of this
thread, is the difference in how the shells handle variables. In
the Bourne shell, the same syntax is used to manipulate shell variables
and environment variables. You make a shell variable into an environment
variable by "export"ing it. In the C-Shell, environment variables must
be set with the "setenv" command, and shell variables use the "set"
command. Generally, environment variables are given upper-case names,
and shell variables use lower-case names. (In Bourne shell, everything
is upper-case.) These are only conventions; you can use mixed-case
everywhere if you wish. 

Finally - the tcsh variable "$tty" - since it is a lower-case name,
and automatically present, we know that it is a shell variable
created explicitly by tcsh. Shell variables are *only* created by a
given shell program. Shells may also create a few environment variables,
so it's *possible* for tcsh or bash to create a "$TTY" environment
variable, but whether they do or not is purely a system-specific
implementation issue. As someone else noted, if TTY is present on a
system, it's usually put there by /bin/login or /etc/getty, not by
the shell, and definitely NOT by the kernel.

I don't know what books you've been reading, but here's one you should
definitely read and remember: The Unix Programming Environment, by 
Brian Kernighan and Rob Pike. It's a rather old book now, but since the
two authors also happen to be two of the authors of Unix, it is definitive.
It won't ever talk about the C-Shell or anything BSD-derived either; for
that you will still need other books. Just remember that as in every other
area in the computing field, the number of people out to make a fast buck
far exceeds the number who actually know what they're doing/talking about.
  -- Howard

(PS: If you care to see why *I* think I know what I'm talking about, my
resume is now online at http://highlandsun.com/hyc/abend.html.)