From owner-freebsd-questions Fri Jan 25 19:57:36 2002 Delivered-To: freebsd-questions@freebsd.org Received: from post.mail.nl.demon.net (post-11.mail.nl.demon.net [194.159.73.21]) by hub.freebsd.org (Postfix) with ESMTP id 0206137B416 for ; Fri, 25 Jan 2002 19:57:00 -0800 (PST) Received: from [212.238.194.207] (helo=tanya.raggedclown.net) by post.mail.nl.demon.net with esmtp (Exim 3.33 #1) id 16UJxa-000Bx8-00 for freebsd-questions@FreeBSD.ORG; Sat, 26 Jan 2002 03:56:59 +0000 Received: by tanya.raggedclown.net (tanya.raggedclown.intra, from userid 500) id 96438452B8; Sat, 26 Jan 2002 04:56:58 +0100 (CET) Date: Sat, 26 Jan 2002 04:56:58 +0100 From: Cliff Sarginson To: freebsd-questions@FreeBSD.ORG Subject: Re: shells confusion Message-ID: <20020126035658.GC1290@raggedclown.net> References: <20020126020430.P175-100000@BLAST> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020126020430.P175-100000@BLAST> User-Agent: Mutt/1.3.24i Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Sat, Jan 26, 2002 at 02:18:16AM +0200, Bernie wrote: > > hi, > > i'm planning to learn shell programming but i'm not sure > on which one to choose... > > i've been reading in the 'FreeBSD unleashed' that people > wanting to do shell programming should stay away from > c-shell as it's realy good for interactive, but very bad > for scripts. is this true? Yes and Yes. > also, looking into the scripts in /etc, i see a line on the > top saying 'bin/sh'. so are they all written in 'sh' and > not csh ? if so, why freebsd comes with csh as default? > /bin/sh is the Unix common denominator of shells, so scripts get written in it. They are not written in csh, because as stated csh script is unusable for all practical purposes. You will be opening up another war here on the subject of which shell should be the default user/root shell. You may notice that "root" has two entries on the system, one as "root" with csh as it's shell, and one as "toor" with sh as it's shell. By the way, csh = tcsh on FreeBSD, I don't know if there is a "pure" csh around anymore. The huge difference between csh as was, and tcsh, being that tcsh is usable (ducks). > also, why single user mode proposes /bin/sh as default? > is there any particular reason for it? > Well it is probably true to say that most (all) Unix users know /bin/sh, not all of them know csh. Again it is the lowest common denominator I guess is the reasoning here. > i'm a bit confused on which shell to pick from programming. > also i've been thinking of perl, but for the moment i think > i've got to learn at least how to do basic shell programming, > not only to write programs, but also to understand scrips that > come with the system. > Leave perl alone for now and learn shell programming. There are a few shells that are super-sets of /bin/sh, notably the Korn shell and the Bash shell. Bash is the one I would personally advise you to use. You need to install it from the ports first. > but the question is 'which shell' ... > > any advice on this matter will be appreciated. > In summary, *not* the csh for scripts. Learn sh for scripts. Use bash or tcsh for your day to day interactive use. I think most people will give you more or less the same advice, the choice of tcsh or bash will mostly depend on their personal Unix backgrounds as much as anything else. -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message