From owner-freebsd-chat Wed Aug 13 13:49:10 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id NAA26535 for chat-outgoing; Wed, 13 Aug 1997 13:49:10 -0700 (PDT) Received: from andrsn.stanford.edu (root@andrsn.Stanford.EDU [36.33.0.163]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id NAA26525 for ; Wed, 13 Aug 1997 13:48:59 -0700 (PDT) Received: from localhost (andrsn@localhost.stanford.edu [127.0.0.1]) by andrsn.stanford.edu (8.8.6/8.6.12) with SMTP id NAA11477; Wed, 13 Aug 1997 13:43:04 -0700 (PDT) Date: Wed, 13 Aug 1997 13:43:04 -0700 (PDT) From: Annelise Anderson To: Joel Ray Holveck cc: Studded@dal.net, FreeBSD-chat@FreeBSD.ORG Subject: Re: Needed: Info on shells and script writing In-Reply-To: <199708130430.AAA11205@ethanol.gnu.ai.mit.edu> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-chat@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Wed, 13 Aug 1997, Joel Ray Holveck wrote: > [...] > Thus were created the shells and counted thus: sh, jsh, rsh, ksh, csh, > tcsh, zsh, and bash, and from these their offspring, too numerous to > count. And thus was never created a judge of shells, and the hackers > shall choose as they see fit. > I love this, the whole thing. On a more mundane and far less entertaining level, here's a draft of the stuff on shells I'm adding to the newuser tutorial...I did a fresh install of 2.2R to find out what had changed since 2.1, and discovered alot had changed...and that the default shell when adding a new user is sh. One of my operating rules is "When in doubt, accept what the gurus give you," but .... So, this is what is proposed to tell new users....remember these are people who ask questions like "What is the name of the administrative account?" and "How do I log out--when I type logout it says 'Not a login shell'?" Comments welcome, even flames. [...] 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. [...] 9. Your Working Environment Your shell is the most important part of your working environment. In DOS, the usual shell is command.com. The shell is what interprets the commands you type on the command line, and thus communicates with the rest of the operating system. You can also write shell scripts, which are like DOS batch files: a series of commands to be run without your intervention. 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. The csh shell is okay, but tcsh does everything csh does and more. It It allows you to recall commands with the arrow keys and edit them. It has tab-key completion of filenames (csh uses the escape key), and it lets you switch to the directory you were last in with cd -. It's also much easier to alter your prompt with tcsh, and to get it to use a different symbol to indicate to you whether you're an ordinary user or root. It makes life a lot easier. 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. 2. As root, edit /etc/shells, adding a line in the file for the new shell, in this case /usr/local/bin/tcsh, and save the file. 3. Use the chsh command to change your shell to tcsh permanently, or type tcsh at the prompt to change your shell without logging in again. Note: Do not change root's shell. It must be either sh or csh, because otherwise you may not have a working shell when the system puts you into single user mode. When you use su -m to become root, you will have tcsh anyway, because the shell is part of the environment. When tcsh starts up, it will read the /etc/csh.cshrc and /etc/csh.login files, as does csh. It will also read the .login file in your home directory and the .cshrc file as well, unless you provide a .tcshrc file. This you can do by simply copying .cshrc to .tcshrc. Now that you've installed tcsh, you can adjust your prompt. You can find the details in the manual page for tcsh, but here is a line to put in your .tcshrc that will tell you how many commands you have typed, what time it is, and what directory you are in. It aslo produces a > if you're an ordinary user and a # if you're root: set prompt = "%h %t %~ %# " This should go in the same place as the existing set prompt line. Comment out the old one; you can always switch back to it if you prefer it. Don't forget the spaces and quotes. [...] Annelise