Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Aug 1997 23:06:13 -0700 (PDT)
From:      Annelise Anderson <andrsn@andrsn.stanford.edu>
To:        Joel Ray Holveck <joelh@gnu.ai.mit.edu>
Cc:        Studded@dal.net, FreeBSD-chat@FreeBSD.ORG
Subject:   Re: Needed: Info on shells and script writing
Message-ID:  <Pine.BSF.3.96.970814213828.17416A-100000@andrsn.stanford.edu>
In-Reply-To: <199708150354.XAA07698@ethanol.gnu.ai.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help


On Thu, 14 Aug 1997, Joel Ray Holveck wrote:


> >> The first time you use adduser, it might ask for some defaults to
> >> save. You might want to make the default shell csh instead of sh, if
> >> it suggests sh as the default. Otherwise just press enter to accept
> >> each default.
> 
> You may want to say how to change this.

I assume people will read the screen, and the tools that have been
provided them are, in most cases, self-explanatory.  I've added a
sentence that explains that these defaults are saved in /etc/adduser.conf,
an editable file.  

> 
> >> Two shells come installed with FreeBSD: csh and sh. csh is good for
> >> command-line work, but scripts should be written with sh (or bash).
> >> You can find out what shell you have by typing echo $SHELL.
> 
> 'echo $SHELL' should be quoted somehow.  If this is in TeXinfo, use
> its @samp (or @code, as you deem appropriate), or use quotes if it's
> in ASCII, but it should be clear that the period is not part of the
> part to type.

What you see above is the outcome of 1) markup in sgml; 2) conversion
to html using "sgmlfmt -d docbook -f html filename"; 3) upload to my
web page where I read it with lynx and mail it to myself; 4) export to
a file for cleanup; 5) import into a mail message.  So what you see
is what a user who downloads the file as text (rather than html source)
will actually get.  By the time it gets to plain text, the formatting
has been stripped.  Actually, I'm beginning to think this sgml stuff 
is pretty cool.    

If you want to look at the html version, it's at
http://andrsn.stanford.edu/FreeBSD/newuser.html, although not
necessarily quite up to date.
 
> >> Here are the three steps for installing a new shell:
> >> 1. Install the shell as a port or a package, just as you would any
> >> other port or package. Use rehash and which tcsh (assuming you're
> >> installing tcsh) to make sure it got installed.
> 
> Reword last sentance.  rehash is sometimes necessary with bash,
> although I haven't figured out when.

My understanding is that sh and bash have an builtin "hash"
command rather than a builtin "rehash" command.  This is actually
a bit of a problem; since the default shell for new users is now sh,
whereas before it was csh, it is now necessary to cover both
possibilities.  I'm implicitly taking the position in this document
that csh and tcsh are the appropriate shells for interactive work
for new users.  

No doubt a case can be made for bash--perhaps on
the grounds that it has the conveniences of tcsh etc. but uses more
of the conventions (e.g., with respect to file descriptors) that one
would use in writing sh shell scripts; and one should actually have
to learn only one shell (plus its enhanced shell) rather than two,
in the beginning.  I.e., bash rather than tcsh will speed up the
process of learning to write shell scripts.  A good argument?

Hash and rehash reread the files in the path.  If you install a new
version of a binary with the same name, it would be unnecessary.  But
otherwise it should be necessary.  My experience (with tcsh) is that
a rehash is necessary as root and again as "user" when one exits root
(because root's environment, which has now changed, is not re-exported
back to the user....maybe).

Actually, I could say:  don't live with sh, install bash, it does xyz.
(And forget csh and tcsh for now.)  I am reluctant to try to cover both,
but actually I'd like to see a parallel paragraph on bash, especially
especially if my above argument for it makes any sense.
 
> I forget, is toor a default user?  Since toor's shell can be changed.

A toor account is installed with the system, if that's what you mean.
Yes, root's shell can be changed; it might be dangerous to do so on
other systems or earlier (I'm not sure how early) versions of FreeBSD.
I have to rewrite this.
> 
> You describe a bit about tcsh and using it, but not bash.  I'll write
> a parallel to bash if you like.

I would like that....I think.  :)

	Annelise





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.3.96.970814213828.17416A-100000>