From owner-freebsd-questions Sat Jan 26 16:11:40 2002 Delivered-To: freebsd-questions@freebsd.org Received: from lists.blarg.net (lists.blarg.net [206.124.128.17]) by hub.freebsd.org (Postfix) with ESMTP id 7238437B404 for ; Sat, 26 Jan 2002 16:11:35 -0800 (PST) Received: from thig.blarg.net (thig.blarg.net [206.124.128.18]) by lists.blarg.net (Postfix) with ESMTP id 06C6CBD3C; Sat, 26 Jan 2002 16:11:35 -0800 (PST) Received: from localhost.localdomain ([206.124.139.115]) by thig.blarg.net (8.9.3/8.9.3) with ESMTP id QAA29317; Sat, 26 Jan 2002 16:11:34 -0800 Received: (from jojo@localhost) by localhost.localdomain (8.11.6/8.11.3) id g0R0EhQ06852; Sat, 26 Jan 2002 16:14:43 -0800 (PST) (envelope-from swear@blarg.net) To: Jim Conner Cc: questions@FreeBSD.ORG Subject: Re: shells confusion References: <947431@toto.iv> <5.1.0.14.0.20020126153501.04980750@mail.enterit.com> From: swear@blarg.net (Gary W. Swearingen) Date: 26 Jan 2002 16:14:42 -0800 In-Reply-To: <5.1.0.14.0.20020126153501.04980750@mail.enterit.com> Message-ID: <4sg04s645p.04s@localhost.localdomain> Lines: 44 User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Cuyahoga Valley) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 Jim Conner writes: > sh is the right way to go. In my last email I suggested ksh and I hold > true to that. Fortunately, if you know how to sh script, you know how > to basicly ksh script. I still suggest scripting in ksh, however. :) I'm afraid that the same could be said for any sh-family script. Worse, if you know how to write ksh (or other advanced shell) script, you don't necessarily know how to write sh script (ie, a script that will work well with other shells that claim to understand sh script). You know too much stuff -- stuff that's only supported by the advanced shell -- but not enough stuff -- all the stuff that makes your script incompatible. Of course, most shell man pages try to tell you what's incompatible, but some aren't very good at it. The FreeBSD sh man page just mentions a "few Berkeley extensions". I suppose those are widely compatible, but it isn't obvious. Will Sun's "sh" or "ksh" or "bash" read almost any FreeBSD "sh" scripts I write using all it's features? But I think you still wind up needing to know at least two shell languages. One that you hope is understood by other shells which you use when you want portability more than a better language and one for the other case. (I which someone would write a man page for that virtual shell language, probably with some notes about unavoidable incompatibilities with various common shells.) I think the suggestion to script in ksh (or bash) is only valid for the non-portable case and the case where you know you can carry the shell with you. The same cases where Python and Perl are competitors with ksh and bash. Since non-portability is generally a bad thing, the issue seems to come down to your choose of language for scripts which require special script interpreters to be installed. From what I've read, ksh93 deserves (except for it's rather restrictive licensing) as much respect as Python or Perl as a choice that should be supported by OS distributions. (But not bash, as it doesn't add enough over portable "sh". OK for the command line, but not for scripting.) But the beginner's first language should always be portable "sh" (the closest to this being "sh" on FreeBSD and (AFAIK) with other sh-family shells being usable only if their "incompatibility/POSIX" notes are paid attention to. (And "pdksh" is best for that, IMO, as it's truly free, portable, well-documented regarding incompatibilities, more sh-compatible than bash, and is good for interactive use.) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message