tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: mksh import

,--- You/David (Sat, 1 Jan 2011 11:52:43 +0000) ----*
| On Fri, Dec 31, 2010 at 09:15:47PM -0500, Alex Goncharov wrote:
| > Let me try to offer you a user's perspective.

Note that: "a user's perspective".  I use what I find best working for
me and am just trying to share the experience -- feel free to

And, these days, I am not using NetBSD at all; make what you want of it.

| Actually I've written quite a lot of scripts and use long command lines,
| (and have done so for many, many years) and rather wish that bash
| didn't exst!

Its existence doesn't force you use it.

| > I don't care much (remember, I am a user, not an OS provider, which
| > would be a different story) about the strict /bin/sh or POSIX.N
| > compatibility.  Neither I, nor most of the (very skilled) people
| > around myself would be able to correctly explain what that means.
| If you want to write scripts that are portable between machines, you
| need to ensure that you only use the 'posix' features.

No: I only need to have the same version of the interpreter (Bash)
installed on all machines.  Which is simple.

| Unfortunately bash doesn't implement some of them, and has a lot of
| non-standard extensions that really just cause portability issues.

As I said, I don't care if a standards body approved a Bash feature
-- I care about being able to do a job.  Bash being not portable would
make me think about using a different shell but because it is more
portable than anything else, why should I care about a "standard"?
It works; it works well.

| If you really want portability you need to restrict yourself to the
| 'traditional' bourne shell (eg /bin/sh on solaris).

See the above.

| That doesn't stop you writing complex scripts, but does require
| lateral thought to avoid the costs of running 'expr' (etc).

I don't want "complex scripts" -- I want the simple ones, to do
complex things.

I did see "complex /bin/sh" scripts, thank you.

| > With Bash, I have a uniform and extremely efficient environment for
| > both command line manipulation and scripting;
| Bash is a very slow shell for running scripts - so not efficient!

Can you support this statement? Can you give me a test case to try the
performance of various shells (I have access to many)?  Thanks in

| >   * Constantly evolving, adding new powerful features;
| That goes against your statement of 'uniform' - since if you find start
| using any new feature, your scripts will fail to work on any old
| systems.

Not if I install Bash 4.1 (e.g.) everywhere -- and why not?  What
forces me to have '/bin/bash' rather than '/elsewhere/bash'?

| Additionally new fetaures tend to have slight side effects on some
| (maybe obscure) scripts - which is probably why Sun never updated
| /bin/sh

Where is Sun now?

What is the default interactive shell in OpenSolaris now?  (/bin/bash,
in case you never tried.)

| >   * Extremely well documented;
| Hmmm... I doubt it, certainly the 'man' page is as terse as ever and
| won't describe any of the finer points (and maybe stop you doing things
| which shouldn't really be allwed).

Don't doubt it -- use "info bash" and see.

If "info" is a problem for you:

| >   * Probably (a.k.a. "in my experience") has fewer bugs than Ksh
| >     implementations.
| Netbsd's ksh doesn't get that much attention (neither will other OS's
| versions these days), so that is likely.
| Bugs in the shell parses can be difficult to fix without creating
| larger problems elsewhere, this is partially due to the add-hock nature
| of parts of the language (which are, in some cases, defined to match
| the historic behaviour).

Bash looks better now, right? ;-)

| > These days I only rarely have to use Perl to do something I cannot
| > easily do in Bash with a small mix-in of Awk and Sed.
| Perl? the only people who use perl for general scripting started on
| windows - where there isn't a shell (actually windows is only usable
| with the cygwin tools installed!)

You counted all the people who use Perl?... Well, I was not included,
then :-)

| > Excluding Zsh, which I have never used, would I be able to do that
| > kind of scripting in any other shell?  Maybe in Ksh... some of
| > it... struggling with bugs and learning more and more "don't do this"
| > rules.
| Unless you are doing some very obscure (or broken!) things netbsd's
| /bin/sh (which is based on ash) should work fine - and as well as
| most versions of ksh.
| bash has some extensions, but for portability they are best avoided.

Thank you -- NetBSD is not my platform. I was just talking about my
personal understanding of what would make a "modern shell", to
(hopefully) help other people.

| > Would any of those shell lend me an interactive environment with at
| > least 50% of what Bash gives me?  No way.
| You still haven't said which bash features you consider so
| important.

I don't have to -- I am not selling Bash here.


-- Alex -- --

Home | Main Index | Thread Index | Old Index