Date: Sun, 27 Jan 2002 05:59:45 +0100 From: Cliff Sarginson <cliff@raggedclown.net> To: questions@freebsd.org Subject: Re: shells confusion Message-ID: <20020127045945.GA1370@raggedclown.net> In-Reply-To: <20020126212234.F32706@roman.mobil.cz> References: <55357420@toto.iv> <15443.2994.224928.912973@guru.mired.org> <20020126212234.F32706@roman.mobil.cz>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jan 26, 2002 at 09:22:34PM +0100, Roman Neuhauser wrote: > > Date: Sat, 26 Jan 2002 14:04:02 -0600 > > To: questions@freebsd.org > > Subject: Re: shells confusion > > From: "Mike Meyer" <mwm-dated-1012507443.766c29@mired.org> > > > > For those interested in *why* scripting in csh is a bad idea, I > > recommend <URL: http://language.perl.com/versus/csh.whynot >. > > > > Please don't bother saying "this is fixed in FOOBARcsh". I believe > > you, but that doesn't help with the basic problem. > > > > Now, where did I leave that zsh manual??? > > I use zsh too. You can finetune it to the exact combination of tcsh- > and bash-like behavior you like. > > Oh, and the manual is in /usr/local/share/doc/zsh. :) > Well, what an interesting set of replies ! Someone has pointed out that the Bourne Shell does itself have some varieties. (For the person who mentioned it I believe that the original original Bourne Shell, as used on the 6th Edition, was re-written I recall for the 7th Edition, I am not even sure if it was by Mr Bourne. The original had a "goto" statement implemented if I recall correctly as an external program ..!. I once had the "pleasure" of putting some changes into the 6th Edition shell to create a restricted shell, which did not exist then. That was fine if you knew Algol68, which is what Mr Bourne loved, and he used the "C" preprocessor to full extent to try and make "C" look like Algol68). That aside, as someone who has worked for years in multi-Unix environments I have never had any significant problem in moving Bourne shell scripts from one platform to another. I was also used the Korn shell for day to to day use. I found it, to have a Heinz like variety of differences betweent platforms, especially to do with the treatment of aliases and functions, which seemed inconsistent even when <ctrl/v> -- which gives you the ksh version number -- said the same thing. I have never used pdksh, so I cannot speak for that. That aside, everyone knows that "sh" lacks a lot that is found in bash, ksh and zsh. But for all practical purposes these are super (or in the case of zsh super-super) sets of "the shell". So learning to script in sh gives you a) a knowledge of writing portable scripts and b) a good ground for learning any of the other sh-like shells. And yes, as noted on the manual page, bash is huge and slow, neither of which I find a reason to *not* use it, since speed is rarely an issue in a shell script (it would not be written in script if speed was a critical issue in the first place). I am making a transition on these systems from having hosts here based on Linux to ones based on FreeBSD. I have a huge number of scripts written using bash facilities (since at the time of writing they were not intended for use outside of the Linux environment), except for changing the "#!" line and the names/ parametersi/locations for some external commands (which is inevitable, show me how to write portable commands to the "route" program) not a single one has needed a change. So, from all this I think the majority advice still seems to be "sh --> sh-variants" for scripting, choose your poison for interactive use. And to the csh die-hards, I just say "2>&1". -- Regards Cliff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020127045945.GA1370>