Loading ...
Sorry, an error occurred while loading the content.

Suggestion: make ksh default for ft=sh

Expand Messages
  • Zdenek Sekera
    It is a well known fact that in maybe all comercial Unix s the /bin/sh - to /bin/ksh, some variant of ksh (Korn shell). The old good Bourne shell (sh) is
    Message 1 of 29 , Jul 27, 2001
    • 0 Attachment
      It is a well known fact that in maybe all comercial Unix's
      the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
      The old good Bourne shell (sh) is either nowhere to be found
      or it is accesible as something else, maybe /bin/osh and other
      variants.

      There is really no harm in that: the sh is a subset of ksh
      (I know there are subtle differences in functionality of
      no consequence to 99.999999% of mortals), the *pure* sh script
      will work without a change in ksh.

      More: the ksh has now become a free software (at least for
      home users). Those who follow comp.unix.shell will agree
      that what's discussed is ksh.

      Vim is treating ksh as the superset of sh. That's correct,
      too, (rather then sh being treated as subset of ksh), this
      can be seen e.g. from syntax/sh.vim,, where to get the ksh
      syntac highlighting, the b:is_kornshell has to be set by
      the user, the default being the sh.

      What I'd like to suggets is to consider the ksh as the default,
      rather than sh. This would conform more to the current trend
      I mentioned above. The realeas of vim 6.0 would be good time
      for this, since this release will bring other very significant
      and (i'm sure very liked) features.

      Benefits:
      - conform to *current unix practice*, meaning when I use/write
      a shell script, I know it will be executed as ksh script (see
      above) so why should I need to tell vim it's ksh when I don't
      need to (anymore) say anything to the O/S.
      - so no need to specify (or forget) b:is_kornshell

      Backward compatibility:
      - probably a 100%:
      - those who specify b:is_kornshell can leave it there, no harm
      - those who didn't (didn't know about it, didn't care, forgot)
      will get as a additional benefit that finally their highlighting
      will be correct without them doing anything ('this vim 6.0
      is really good, finally my sh highlighting is correct!')
      - those who think 'make sure vim knows it's ksh' and set
      b:is_kornshell will be rewarded: no degradation will happen :-)
      - those who run pure sh will have the correct highlighting, too.
      - but those, who have ksh script, will have the highlighting
      correct without b:is_kornshell, which is definitely
      a setup simplification

      What's to blame?:
      - I don't know, tell me.

      What's need to be done:
      - the maintainer (Dr.Chip) would have (to agree) to do some
      minimal work on syntax/sh.vim

      Opinions? Did I miss something earth shattering?

      ---Zdenek
    • Zdenek Sekera
      ... Very true, however, there would be no difference for vim users: if they wanted to have syntax highlighting for bash, they had to say b:is_bash, in the new
      Message 2 of 29 , Jul 27, 2001
      • 0 Attachment
        zellerin@... wrote:
        >
        > On Fri, Jul 27, 2001 at 02:58:56PM +0200, Zdenek Sekera wrote:
        > > What I'd like to suggets is to consider the ksh as the default,
        > > rather than sh. This would conform more to the current trend
        > > I mentioned above. The realeas of vim 6.0 would be good time
        > > for this, since this release will bring other very significant
        > > and (i'm sure very liked) features.
        > >
        > > Opinions?
        > However, there are environments (most GPL based systems I believe,
        > Linuxes about them) where /bin/sh is linked to Bourne again shell
        > - bash. I do not know what is a difference between those or whether it
        > would be of importance.
        >

        Very true, however, there would be no difference for vim users:
        if they wanted to have syntax highlighting for bash, they had to
        say b:is_bash, in the new scheme they would have to do the same.

        > As far as I know, every shell script should identify itself at first
        > line with #!;

        ...if the O/S supports that, it's BSDish...
        but nowadays most do.

        > if sh is there, it should be really in bourne shell for
        > sake of compatibility,

        It would be nice if it was that way, but as I said in my email
        most vendors link sh to ksh so you get whatever your O/S says
        the /bin/sh is, if it is ksh, that's what you get.

        > if it is meant to be ksh, it should say it there.

        In most O/S you can also say #!/bin/ksh and you get ksh (If you
        said #!/bin/sh you would get ksh, too, if the O/S links
        /bin/sh->/bin/ksh, most do as I said above.

        It's when you *really* want to get the *real* Bourne sh
        (there maybe be real cases, e.g. if you absolutely want
        to develop the script that will run *anywhere* (hahaha))
        then on those O/S you (usually) have to say something like
        #!/bin/osh (for *old* sh or similar).

        Note, if you *really* wanted the *pure sh* highlighting
        in vim (when the ksh is the default), you can specify 'is_sh',
        syntax/sh.vim has forseen that. (Today that's the default).
        I am trying only to change the default to make *most* sh
        users compatible with the unix pratice of today, nothing
        more.

        But why would want *sh* ? Maybe when you want to highlight
        violations of *pure sh* syntax? Well, I think it's safer
        to just run that script and you get those errors right
        away, I wouldn't absolutely trust the vim syntax highlighting
        to that extend, after all it is not a language parser.

        > If the current script takes the header into account
        > (I do not know if it
        > does), I would consider it sufficient.
        >

        I think it actually tries, but it cannot know if the O/S
        runs ksh when you say #!/bin/sh. It can just say this way
        'this script is sh'ish as opposed to csh'ish'.

        > Just an opinion

        Sure, that's valuable.

        ---Zdenek
      • Dan Sharp
        ... ... Even though this is true for commercial Unices, it isn t for the noncommercial ones, like Linux and (maybe?) *BSD. On my Red Hat Linux 7.0,
        Message 3 of 29 , Jul 27, 2001
        • 0 Attachment
          At 02:58 PM 7/27/2001 +0200, Zdenek Sekera wrote:
          >It is a well known fact that in maybe all comercial Unix's
          >the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
          >The old good Bourne shell (sh) is either nowhere to be found
          >or it is accesible as something else, maybe /bin/osh and other
          >variants.

          <snip>

          >What I'd like to suggets is to consider the ksh as the default,
          >rather than sh. This would conform more to the current trend
          >I mentioned above. The realeas of vim 6.0 would be good time
          >for this, since this release will bring other very significant
          >and (i'm sure very liked) features.

          Even though this is true for commercial Unices, it isn't for the
          noncommercial ones, like Linux and (maybe?) *BSD. On my Red Hat Linux 7.0,
          /bin/sh -> /bin/bash, which I believe is standard for most other
          distributions as well. I think bash is supposed to be compatible with the
          1988 implementation of ksh, but I don't know about compatibility with the
          newest (1993) ksh implementation. According to an interview with David
          Korn at http://slashdot.org/articles/01/02/06/2030205.shtml he says:

          "I have not looked at bash for several years and some of the features I
          describe here might now be implemented by bash. I sent Chet Ramey, author
          of bash, the list of new features in ksh93 years ago so that if these
          features get implemented in bash, they would be compatible."

          I don't know much about bash in particular, so I don't know how compatible
          they are. I just wanted to mention the difference in the commercial /
          noncommercial versions.

          Dan Sharp
        • Zdenek Sekera
          ... ... Yes, but there is is_bash to set in all cases as I mentioned in another mail. So: - when *sh* is default you have to set is_bash to get bash
          Message 4 of 29 , Jul 27, 2001
          • 0 Attachment
            Dan Sharp wrote:
            >
            > At 02:58 PM 7/27/2001 +0200, Zdenek Sekera wrote:
            > >It is a well known fact that in maybe all comercial Unix's
            > >the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
            > >The old good Bourne shell (sh) is either nowhere to be found
            > >or it is accesible as something else, maybe /bin/osh and other
            > >variants.
            >
            > <snip>
            >
            > >What I'd like to suggets is to consider the ksh as the default,
            > >rather than sh. This would conform more to the current trend
            > >I mentioned above. The realeas of vim 6.0 would be good time
            > >for this, since this release will bring other very significant
            > >and (i'm sure very liked) features.
            >
            > Even though this is true for commercial Unices, it isn't for the
            > noncommercial ones, like Linux and (maybe?) *BSD. On my Red Hat Linux 7.0,
            > /bin/sh -> /bin/bash, which I believe is standard for most other
            > distributions as well. I think bash is supposed to be compatible with the
            > 1988 implementation of ksh, but I don't know about compatibility with the
            > newest (1993) ksh implementation. According to an interview with David
            > Korn at http://slashdot.org/articles/01/02/06/2030205.shtml he says:
            ...
            Yes, but there is is_bash to set in all cases as I mentioned
            in another mail.
            So:
            - when *sh* is default
            you have to set is_bash to get bash highlighting

            - if/when *ksh* is the default
            you have to set is_bash to get bash highlighting

            Can't see the difference for bash user's :-)

            ---Zdenek
          • Dan Sharp
            ... This is true, but it seems like the argument would be the same after s/bash/ksh/ and wanting bash highlighting to be the default. Also, Vim is usually the
            Message 5 of 29 , Jul 27, 2001
            • 0 Attachment
              At 03:58 PM 7/27/2001 +0200, Zdenek Sekera wrote:

              >zellerin@... wrote:
              > >
              > > On Fri, Jul 27, 2001 at 02:58:56PM +0200, Zdenek Sekera wrote:
              >
              >Very true, however, there would be no difference for vim users:
              >if they wanted to have syntax highlighting for bash, they had to
              >say b:is_bash, in the new scheme they would have to do the same.

              This is true, but it seems like the argument would be the same after
              s/bash/ksh/ and wanting bash highlighting to be the default. Also, Vim is
              usually the standard vi on Linux systems (at least), but I believe must be
              installed separately on commercial systems, since they already have a
              proprietary vi. Since it is being installed as a custom addition to the
              system, it makes sense that it would take a customization to make it match
              that system, like setting the default sh highlighting to match the default
              /bin/sh implementation. (BTW, I'm not arguing that b:is_bash should be set
              to the default or anything :) )

              > > if it is meant to be ksh, it should say it there.
              >
              >In most O/S you can also say #!/bin/ksh and you get ksh (If you
              >said #!/bin/sh you would get ksh, too, if the O/S links
              >/bin/sh->/bin/ksh, most do as I said above.

              I think the point was that if you are writing a script that uses ksh
              features (for which you want the ksh highlighting) you should have
              #!/bin/ksh and not just #!/bin/sh at the top, even if /bin/ksh is what
              would actually be run in both cases. The highlighting should match the
              target (#!/bin/sh or #!/bin/ksh) and not the implementation (/bin/ksh or
              /bin/bash or ...).

              Dan Sharp
            • Preben Guldberg
              [Some of this is purely out of interest, I hope you will bear with the length of it.] ... Could you make a quick rundown of which Unix flavours are like that?
              Message 6 of 29 , Jul 27, 2001
              • 0 Attachment
                [Some of this is purely out of interest, I hope you will bear with the
                length of it.]

                Thus wrote Zdenek Sekera (zs@...) on [010727]:
                > It is a well known fact that in maybe all comercial Unix's
                > the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
                > The old good Bourne shell (sh) is either nowhere to be found
                > or it is accesible as something else, maybe /bin/osh and other
                > variants.

                Could you make a quick rundown of which Unix flavours are like that?

                Not sure which of these are up to beat (or if some admin replaced the
                original file - though I sincerely doubt that):

                Solaris 8: /bin/ls is a regular file
                IRIX 6.5: /bin/ls points to /sbin/ls (regular file)
                HP-UX: /bin/ls is a regular file
                AIX 4.2: /bin/ls is a regular file

                This is not a thorough investigation, though. I have not tested them
                all for ksh features.

                The Solaris one, at least, is not too happy about a few constructs;
                off the top of my head:

                [[ test ]]
                dirpart=${file%/*}
                n=${#N}
                let num=2+2
                n=$((2*24-6))
                script=$(echo $0)
                ls +(foo|bar)*
                ls -l ~
                print -n "ok? (y/n) "
                function TRUE { true; }
                set -A files `ls`
                file1=${files[0]}

                All of these work when /usr/bin/ksh is invoked as a link called sh
                (which some shells use to see if they should attempt to be compatible).

                Btw, some of these are already highlighted for sh, so you are halfway
                there :-)

                > There is really no harm in that: the sh is a subset of ksh
                > (I know there are subtle differences in functionality of
                > no consequence to 99.999999% of mortals), the *pure* sh script
                > will work without a change in ksh.

                Same can be said (or at least is said of/expected from :-) bash, which
                is also a /bin/sh replacement for some.

                As for writing pure scripts, this often goes hand in hand with what
                you expect. If your regular /bin/sh is a bash or ksh, you may slip in
                some details that are not /bin/sh proper on other OSs. Particularly
                common are "${foo#*/}" and friends.

                > More: the ksh has now become a free software (at least for
                > home users).

                This, I think, has nothing to do with the syntax highlighting :-)

                > Those who follow comp.unix.shell will agree
                > that what's discussed is ksh.

                Hmm - perhaps one should go back there for a while.

                > Vim is treating ksh as the superset of sh. That's correct,
                > too, (rather then sh being treated as subset of ksh), this
                > can be seen e.g. from syntax/sh.vim,, where to get the ksh
                > syntac highlighting, the b:is_kornshell has to be set by
                > the user, the default being the sh.

                That argument applies to bash as well.

                So if ksh is a subset of bash, basic bash (that is, the supposed sh
                compatible subset) would be highlighted correct. I doubt this really
                is so (take "[[ test ]]" constructs).

                > What I'd like to suggets is to consider the ksh as the default,
                > rather than sh. This would conform more to the current trend
                > I mentioned above.

                Could you cite a reference for this trend? You really have peaked my
                curiosity.

                > Benefits:
                > - conform to *current unix practice*, meaning when I use/write
                > a shell script, I know it will be executed as ksh script (see
                > above) so why should I need to tell vim it's ksh when I don't
                > need to (anymore) say anything to the O/S.

                Can be that this is current unix practice - I still would concider it
                bad practise to use ksh specific features for scripts to be
                interpreted by /bin/sh.

                If /bin/ksh is so common you can rely on it (as you do by expecting
                /bin/sh to point to it), you really should specify that is is your
                intention to use ksh specific features by using a proper '#!/bin/ksh'
                line.

                > - so no need to specify (or forget) b:is_kornshell

                If you are in a position to set it and forget about it, why not just
                do so?

                > Opinions?

                As you might have guessed, the idea does not appeal to me.

                sh.vim mostly deals with sh proper only, and I concider this a good
                thing. Too many of the argument (for my tase) could easily come from a
                bash camper.

                > Did I miss something earth shattering?

                Beats me. Ask the bash crowd :-)

                Peppe
                --
                "Before you criticize someone, walk
                Preben "Peppe" Guldberg __/-\__ a mile in his shoes. That way, if
                c928400@... (o o) he gets angry, he'll be a mile away
                ----------------------oOOo (_) oOOo-- - and barefoot." --Sarah Jackson
              • Ali Akcaagac
                ... well its a well known fact that bash is widely used on nowdays linux system. i know of some people that use csh and tcsh but well thats only a minority of
                Message 7 of 29 , Jul 27, 2001
                • 0 Attachment
                  On 2001.07.27 14:58:56 +0200 Zdenek Sekera wrote:
                  > It is a well known fact that in maybe all comercial Unix's
                  > the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
                  > The old good Bourne shell (sh) is either nowhere to be found
                  > or it is accesible as something else, maybe /bin/osh and other
                  > variants.

                  well its a well known fact that bash is widely used on nowdays
                  linux system. i know of some people that use csh and tcsh but
                  well thats only a minority of people.

                  90% of all scripts available under linux are using bash compatible
                  syntax.

                  > What I'd like to suggets is to consider the ksh as the default,
                  > rather than sh. This would conform more to the current trend
                  > I mentioned above. The realeas of vim 6.0 would be good time
                  > for this, since this release will bring other very significant
                  > and (i'm sure very liked) features.

                  nono seriously... the thing that makes unix bsd linux come up
                  again to its high points is the growing linux community. the
                  majority use vim or xemacs on linux as their main editor i don't
                  recommend switching to an RARELY used shell that probably break
                  all kinda compatibility to bash. i dont know of one linux distro
                  that dont use bash as their main shell.

                  well thats my 0.2 cents. i only hope that i understand your question
                  correctly so dont feel confused if i didn't aswer correctly to your
                  mail.

                  --
                  Name....: Ali Akcaagac
                  Status..: Student Of Computer & Economic Science
                  E-Mail..: mailto:ali.akcaagac@...-wilhelmshaven.de
                  WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
                • Zdenek Sekera
                  ... True, vim comes with a freeware (if there is any for *that* unix). ... I understand, what I am saying that virtually all comercial unix s have ksh as
                  Message 8 of 29 , Jul 27, 2001
                  • 0 Attachment
                    Dan Sharp wrote:
                    >
                    ...
                    > Also, Vim is
                    > usually the standard vi on Linux systems (at least), but I believe must be
                    > installed separately on commercial systems, since they already have a
                    > proprietary vi.

                    True, vim comes with a freeware (if there is any for *that* unix).

                    > Since it is being installed as a custom addition to the
                    > system, it makes sense that it would take a customization to make it match
                    > that system, like setting the default sh highlighting to match the default
                    > /bin/sh implementation. (BTW, I'm not arguing that b:is_bash should be set
                    > to the default or anything :) )

                    I understand, what I am saying that virtually all comercial unix's have
                    ksh as default (forget the way you get it). I am arguing that since
                    ksh is the O/S default, one should consider vim having the same default.

                    Take it this way (and simplify): the unix world (linux is unix...) is
                    split between sh, ksh, bash, (I am not talking about csh'ish, different
                    animal). Pure *sh* is almost nowhere (arguments beaten already).

                    So we have ksh and bash. (Remeber ksh is now opensoft, I am sure
                    lots of linux people are tempted, besides the point).

                    Consequently: having sh default when it is (virtually) nowhere seems
                    pointless to me. Remains bash and ksh (again: ft=sh). Pick one.
                    I am saying ksh *is* the natural choice (and I understand
                    disagreements).

                    And if you think of it even more: the result is this:

                    - ksh people would get right by default
                    - sh people would get it right by default
                    - those who specified is_kornshell have a choice: take it away
                    or leave it. It will work correctly in both cases.
                    - bash needed to specify is_bash, have to still do it, no change
                    - only those who *really* want sh will need now to specify is_sh.
                    The real question here: why do would they require pure *sh*.
                    Only they will know, I's argue they are not negligible but
                    a small minority. This because of the fact that ksh is now so
                    spreadout (and bash is very close in syntax, closer to ksh than
                    sh), that the need for pure sh scripts is dimishing like a snow
                    from the last year (my grandmother would say :-)).

                    Yes there is that trivial work in syntax/sh.vim to do.

                    ...
                    > I think the point was that if you are writing a script that uses ksh
                    > features (for which you want the ksh highlighting) you should have
                    > #!/bin/ksh and not just #!/bin/sh at the top, even if /bin/ksh is what
                    > would actually be run in both cases. The highlighting should match the
                    > target (#!/bin/sh or #!/bin/ksh) and not the implementation (/bin/ksh or
                    > /bin/bash or ...).

                    Yes, in a ideal world, but you may also leave out the #!/bin/whatever
                    altogether (as most script on a given site/place will do) and you
                    get whatever O/S will give you. It'll be ksh, I bet :-)

                    ---Zdenek
                  • Charles E. Campbell
                    Hello! I have to agree that if a script is expecting to run as a bash script it should say so (#! /bin/bash) or as a ksh script it should say so (#! /bin/ksh),
                    Message 9 of 29 , Jul 27, 2001
                    • 0 Attachment
                      Hello!

                      I have to agree that if a script is expecting to run as a bash script it
                      should say so (#! /bin/bash) or as a ksh script it should say so (#!
                      /bin/ksh), even though /bin/sh may be linked to one or the other.
                      However, especially with Linux, there are users who don't know that
                      /bin/sh isn't real sh and don't even know they have an option.

                      One problem: what to assume about <.profile>. The startup script
                      doesn't let us know for sure which shell is intended; I don't think
                      I've ever seen a #!... construct at the top of a <.profile>, for
                      example.

                      I think having the default be Bourne shell helps illuminate this
                      matter for folks, because they have to choose is_kornshell or is_bash
                      or put up with lots of Error highlighting.

                      Personally, I use pdksh under Linux, bash under Cygwin, and ksh on my
                      (old) SGI. Ah, well, I'm not politically correct anyway, so I favor
                      keeping Bourne shell as default.

                      Regards,
                      C Campbell

                      --
                      Charles E Campbell, Jr, PhD _ __ __
                      Goddard Space Flight Center / /_/\_\_/ /
                      cec@... /_/ \/_//_/
                      PGP public key: http://www.erols.com/astronaut/pgp.html
                    • Bohdan Vlasyuk
                      ... I guess there are separate profiles for each shell. E.g. on all RH distributions I ve seen, there s no .profile, yet there s .bash_profile for bash. So why
                      Message 10 of 29 , Jul 27, 2001
                      • 0 Attachment
                        On Fri, Jul 27, 2001 at 11:38:47AM -0400, Charles E. Campbell wrote:

                        > One problem: what to assume about <.profile>. The startup script
                        > doesn't let us know for sure which shell is intended; I don't think
                        > I've ever seen a #!... construct at the top of a <.profile>, for
                        > example.
                        I guess there are separate profiles for each shell. E.g. on all RH
                        distributions I've seen, there's no .profile, yet there's
                        .bash_profile for bash. So why there can't be .XYZ_profile for XYZ ?
                        I think keeping .profile as sh-compatible, and tweak .bash_profile for
                        bash would be wise choice, so that no csh would complain on your
                        .profile.



                        --
                        The verdict of a jury is the a priori opinion of that juror who smokes
                        the worst cigars.
                        -- H. L. Mencken
                      • Ali Akcaagac
                        ... no not true.. please inform yourself. unix != linux != bsd != (vms, windows, amigaos, beos and whatever) on the growing majority of linux distributions
                        Message 11 of 29 , Jul 27, 2001
                        • 0 Attachment
                          On 2001.07.27 17:24:10 +0200 Zdenek Sekera wrote:
                          > Take it this way (and simplify): the unix world (linux is unix...) is
                          > split between sh, ksh, bash, (I am not talking about csh'ish, different
                          > animal). Pure *sh* is almost nowhere (arguments beaten already).

                          no not true.. please inform yourself.

                          unix != linux != bsd != (vms, windows, amigaos, beos and whatever)

                          on the growing majority of linux distributions BASH is the default
                          linked to /bin/sh. your problem is that YOU want to enforce vim
                          to support ksh as default because its what you prefer using.

                          i know people that uses csh, tcsh also ksh and whatever but i think
                          its the best way to keep that as default whats used out of scratch
                          on a majority of these distributions.

                          --
                          Name....: Ali Akcaagac
                          Status..: Student Of Computer & Economic Science
                          E-Mail..: mailto:ali.akcaagac@...-wilhelmshaven.de
                          WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
                        • Zdenek Sekera
                          ... I ve read it all and I like it, like all tips from you ! ... ^^ ... I gather you meant to write /bin/sh right? I don t see how /bin/ls can enter this
                          Message 12 of 29 , Jul 27, 2001
                          • 0 Attachment
                            Preben Guldberg wrote:
                            >
                            > [Some of this is purely out of interest, I hope you will bear with the
                            > length of it.]
                            >

                            I've read it all and I like it, like all tips from you !

                            ...
                            > Could you make a quick rundown of which Unix flavours are like that?
                            >
                            > Not sure which of these are up to beat (or if some admin replaced the
                            > original file - though I sincerely doubt that):
                            >
                            > Solaris 8: /bin/ls is a regular file
                            > IRIX 6.5: /bin/ls points to /sbin/ls (regular file)
                            > HP-UX: /bin/ls is a regular file
                            > AIX 4.2: /bin/ls is a regular file
                            ^^
                            >

                            I gather you meant to write /bin/sh right? I don't see how
                            /bin/ls can enter this discussion :-)

                            > This is not a thorough investigation, though. I have not tested them
                            > all for ksh features.
                            >
                            > The Solaris one, at least, is not too happy about a few constructs;
                            > off the top of my head:
                            ...

                            I really can't, I don't have a ready access to other systems from
                            my office, but maybe the way SGI is doing may shed some light:

                            $ cd /
                            $ ls -l /bin/*sh*

                            /bin/bsh -> ../../sbin/bsh
                            /bin/ksh -> ../../sbin/sh
                            /bin/rksh -> ../../sbin/sh
                            /bin/sh -> ../../sbin/sh

                            (I cutout the beginning of ls output and irrelevant files matching *sh*)

                            Here the bsh is the Bourne shell, otherwise /bin/sh and /bin/ksh point
                            to the same executable

                            Now take this script (and call it 'whatsh') and execute, remember
                            Bourne shell has no 'print' statement, only echo:

                            #!/bin/sh
                            print 1

                            $ whatsh
                            1 -> how come, the script was specified as /bin/sh ??? shoudln't
                            it fail?

                            Make it:

                            #!/bin/ksh
                            print 1

                            $ whatsh
                            1 -> normal

                            Make it:

                            #!/bin/bsh
                            print 1

                            $ whatsh
                            print: Not found -> aha, so bsh *cannot* be ksh!

                            One can talk and argue, but this is it: #!/bin/sh and #!/bin/ksh
                            are the same thing. Specifying one or the other makes no difference.
                            More, take away the #!/bin/sh from our script
                            the 'new' script will have just

                            print 1

                            $ /bin/ksh new
                            1 --> so the default shell *is* ksh

                            The rest of my claims about commercial unix's is from comp.unix.shell
                            but not all unix's do it the same way. But the general claim is has
                            become the default (with old sh still being available bsh/osh/...).

                            > Btw, some of these are already highlighted for sh, so you are halfway
                            > there :-)
                            >
                            > > There is really no harm in that: the sh is a subset of ksh
                            > > (I know there are subtle differences in functionality of
                            > > no consequence to 99.999999% of mortals), the *pure* sh script
                            > > will work without a change in ksh.
                            >
                            > Same can be said (or at least is said of/expected from :-) bash, which
                            > is also a /bin/sh replacement for some.
                            >

                            I heard that (never used bash, I have Linux at home and the first
                            thing I did was to download ksh :-)!

                            > As for writing pure scripts, this often goes hand in hand with what
                            > you expect. If your regular /bin/sh is a bash or ksh, you may slip in
                            > some details that are not /bin/sh proper on other OSs. Particularly
                            > common are "${foo#*/}" and friends.
                            >

                            Absolutely true.
                            Also remember, not all ksh's on commercial unix's are the same
                            versions. And they differ in things, most notable differences
                            are of course between ksh93 and ksh88, but even within ksh88
                            depends on which version your vendor paid the license to AT&T.

                            > > More: the ksh has now become a free software (at least for
                            > > home users).
                            >
                            > This, I think, has nothing to do with the syntax highlighting :-)
                            >

                            It does, you need more colors and more clever regexps :-) (Ask
                            Dr.Chip!)
                            But what lots of people believe, the real ksh (the *real* thing)
                            will become more popular with Linux community because it is
                            a very solid language foundation. Some argue that bash/zsh/etc
                            were really written (and made so similar with ksh !!!), because
                            the old ksh licence was expensive, that's the freeware vengence
                            against high prices, I guess).

                            > > Those who follow comp.unix.shell will agree
                            > > that what's discussed is ksh.
                            >
                            > Hmm - perhaps one should go back there for a while.
                            >

                            I'd like to correct myself, there are bash and sh questions, too,
                            but proportionally the sum of both can't compete with ksh.
                            That's my 3+ years with comp.unix.shell.

                            ...
                            >
                            > So if ksh is a subset of bash,

                            I never said that, never thought so and disagree with you,
                            from which of my statements did you get this feeling?

                            > basic bash (that is, the supposed sh
                            > compatible subset) would be highlighted correct. I doubt this really
                            > is so (take "[[ test ]]" constructs).

                            I don't know what's the 'basic set' but from all I know about bash
                            it is far closer to ksh than to sh.
                            >
                            > > What I'd like to suggets is to consider the ksh as the default,
                            > > rather than sh. This would conform more to the current trend
                            > > I mentioned above.
                            >
                            > Could you cite a reference for this trend? You really have peaked my
                            > curiosity.
                            >

                            comp.unix.shell
                            Not a very earth threatening reference, I know :-), but still.
                            *Very* active group.

                            ...
                            > Can be that this is current unix practice - I still would concider it
                            > bad practise to use ksh specific features for scripts to be
                            > interpreted by /bin/sh.
                            >

                            What is /bin/sh ?? (see at the very beginning)
                            I don't see your point anyway, aren't you saying *don't use f90 features
                            in f77*? Shouldn't that be obvious?
                            (Yes, f77 is to f90 what sh is to ksh)

                            > If /bin/ksh is so common you can rely on it (as you do by expecting
                            > /bin/sh to point to it), you really should specify that is is your
                            > intention to use ksh specific features by using a proper '#!/bin/ksh'
                            > line.

                            Doesn't work, see above. That line can no longer be considered
                            a differentiator. Is it because actualy user's of (commercial)
                            unix's wanted it? If ksh runs sh scripts, why would anybody
                            want to maintain the sh binary when ksh would do the same and
                            more and better? Just like f90<->f77. f90 is the song, and it
                            plays well f77 words. I see it only normal. Same for ksh and sh.

                            >
                            > > - so no need to specify (or forget) b:is_kornshell
                            >
                            > If you are in a position to set it and forget about it, why not just
                            > do so?
                            >

                            Well, that's really a good question, maybe the right one.
                            I was running for a long time without is_kornshell and yet *none*
                            of my scripts, nor any other that I need is sh, all is ksh.
                            And wondered why the colors were sometimes weird.

                            Yes I didn't read the manual, spotted is_kornshell totally
                            by accident.

                            I think lots of users (all levels) are like that, try and see
                            and only when all things fail RTFM. I think that's the reason
                            why Bram is so careful with other vim defaults, many times
                            he expressed his drive to make defaults such that the first
                            time user gets it right. Can't be done to the extreme, but to me
                            it is a perfectly valuable thing to try. I certainly agree
                            100% with that.

                            So I am arguing: if the world is (mostly) ksh, why not vim by default?
                            And I know opinions may/will differ, that's OK.

                            I can set it and forget it, but why?, when/if ksh is default, almost
                            nobody will be affected and lot will be happier (TM :-)).

                            > > Opinions?
                            >
                            > As you might have guessed, the idea does not appeal to me.
                            >

                            Yes, I have that feeling. But have you exhausted all your arguments?
                            I am still not convinced. Note, either way it will not change the
                            sense the Earth rotates...

                            > sh.vim mostly deals with sh proper only, and I concider this a good
                            > thing. Too many of the argument (for my tase) could easily come from a
                            > bash camper.
                            >

                            That's home market, however, there are real-world companies that sell
                            well made scripts, only in ksh, never seen one in bash. I don't know
                            if it's an srgument, but still something to think about.

                            The bash comes with Linux surely because it was free and available
                            at the right momnet and GNU backed. Had ksh been free earlier,
                            the tulips may have grown different color :-)

                            > > Did I miss something earth shattering?
                            >
                            > Beats me. Ask the bash crowd :-)

                            Can't, they would beat me :-)!

                            ---Zdenek
                          • Zdenek Sekera
                            ... Man grow up! Tulip != rose != ...right? And Mandrake != RH != Suse != ... How far will you split the hair? We shouldn t be talking on that level. ... How
                            Message 13 of 29 , Jul 27, 2001
                            • 0 Attachment
                              Ali Akcaagac wrote:
                              >
                              > On 2001.07.27 17:24:10 +0200 Zdenek Sekera wrote:
                              > > Take it this way (and simplify): the unix world (linux is unix...) is
                              > > split between sh, ksh, bash, (I am not talking about csh'ish, different
                              > > animal). Pure *sh* is almost nowhere (arguments beaten already).
                              >
                              > no not true.. please inform yourself.
                              >
                              > unix != linux != bsd != (vms, windows, amigaos, beos and whatever)
                              >

                              Man grow up! Tulip != rose != ...right?
                              And Mandrake != RH != Suse != ...
                              How far will you split the hair?
                              We shouldn't be talking on that level.

                              > on the growing majority of linux distributions BASH is the default
                              > linked to /bin/sh. your problem is that YOU want to enforce vim
                              > to support ksh as default because its what you prefer using.
                              >

                              How come bash is linked to /bin/sh? So the sh is bash?
                              And somewher else sh is ksh. Hmmmm...

                              And I don't want to *enforce* vim to do anything, it's just
                              seems to me more logical what I suggest.

                              By the way, what *you* are defending? *Your* bash?
                              Note, not a hair will change for you if ksh is the default.
                              You'll still have to define is_bash if you want to be in sync.
                              I am suggesting something that should leave bash users in peace.
                              Got it?

                              > i know people that uses csh, tcsh also ksh and whatever but i think
                              > its the best way to keep that as default whats used out of scratch
                              > on a majority of these distributions.

                              The Linux contains lots of stuff, even some release alpha vim 6.0
                              with it and distributors don't even get a red face.
                              That's not an argument.

                              ---Zdenek
                            • Tim Mooney
                              ... This is incorrect, so if it s well known , I would be surprised. My experiences with multiple different vendor implementations of UNIX indicate 1)
                              Message 14 of 29 , Jul 27, 2001
                              • 0 Attachment
                                In regard to: Suggestion: make ksh default for ft=sh, Zdenek Sekera said...:

                                >It is a well known fact that in maybe all comercial Unix's
                                >the /bin/sh -> to /bin/ksh, some variant of ksh (Korn shell).
                                >The old good Bourne shell (sh) is either nowhere to be found
                                >or it is accesible as something else, maybe /bin/osh and other
                                >variants.

                                This is incorrect, so if it's "well known", I would be surprised.

                                My experiences with multiple different vendor implementations
                                of UNIX indicate

                                1) Everyone has a /bin/sh
                                2) Everyone has either /bin/ksh or /usr/bin/ksh (or both, if
                                /bin -> /usr/bin)
                                3) *If* /bin/sh is *not* the POSIX shell, then there's a POSIX
                                shell somewhere on the system (e.g. /usr/xpg4/bin/sh,
                                /usr/posix/bin/sh)

                                You can't (and *shouldn't*) make any assumptions about functionality
                                beyond "classic Bourne" being in /bin/sh.

                                For example, shell functions were never *required* to be part
                                of the original Bourne shell. Some vendors (e.g. HP, IBM,
                                SGI) added shell functions (popularized by ksh88) into the
                                /bin/sh . Solaris and Tru64 have a "classic" Bourne /bin/sh ,
                                without shell functions.

                                Then there's stuff like arrays, the ksh `[[ ... ]]' syntax,
                                etc. It doesn't take too many examples to prove that you
                                can't just assume that /bin/sh is going to be able to parse
                                whatever ksh syntax you throw at it.

                                >There is really no harm in that:

                                I'm not sure what you mean by that.

                                > the sh is a subset of ksh
                                >(I know there are subtle differences in functionality of
                                >no consequence to 99.999999% of mortals), the *pure* sh script
                                >will work without a change in ksh.

                                Ok.

                                >What I'd like to suggets is to consider the ksh as the default,
                                >rather than sh.

                                Why? You've already indicated that you know that ksh is a
                                superset of sh (or sh is a subset of ksh, depending on your viewpoint).
                                This means that if you assume ksh, vim will "correctly" highlight
                                scripts that have no chance of working on /bin/sh on a number of
                                platforms. This seems like a bad idea to me.

                                >Benefits:
                                >- conform to *current unix practice*, meaning when I use/write
                                > a shell script, I know it will be executed as ksh script (see
                                > above) so why should I need to tell vim it's ksh when I don't
                                > need to (anymore) say anything to the O/S.

                                You're not writing very portable scripts, then.

                                >Backward compatibility:
                                >- probably a 100%:

                                Only if you forget about platforms like Solaris, Tru64, and
                                FreeBSD (which uses `ash' as /bin/sh).

                                >- those who run pure sh will have the correct highlighting, too.

                                No, they won't.

                                >Opinions? Did I miss something earth shattering?

                                No, but the problem is that your initial premise is wrong. You're
                                *not* safe in assuming that /bin/sh is going to handle ksh or
                                even POSIX sh shell syntax.

                                Tim
                                --
                                Tim Mooney mooney@...
                                Information Technology Services (701) 231-1076 (Voice)
                                Room 242-J6, IACC Building (701) 231-8541 (Fax)
                                North Dakota State University, Fargo, ND 58105-5164
                              • Zdenek Sekera
                                Message 15 of 29 , Jul 27, 2001
                                • 0 Attachment
                                  Zdenek Sekera wrote:
                                  >
                                  > Ali Akcaagac wrote:
                                  > >
                                  > > On 2001.07.27 17:24:10 +0200 Zdenek Sekera wrote:
                                  > > > Take it this way (and simplify): the unix world (linux is unix...) is
                                  > > > split between sh, ksh, bash, (I am not talking about csh'ish, different
                                  > > > animal). Pure *sh* is almost nowhere (arguments beaten already).
                                  > >
                                  > > no not true.. please inform yourself.
                                  > >
                                  > > unix != linux != bsd != (vms, windows, amigaos, beos and whatever)
                                  > >
                                  >
                                  > Man grow up! Tulip != rose != ...right?
                                  > And Mandrake != RH != Suse != ...
                                  > How far will you split the hair?
                                  > We shouldn't be talking on that level.
                                  >
                                  > > on the growing majority of linux distributions BASH is the default
                                  > > linked to /bin/sh. your problem is that YOU want to enforce vim
                                  > > to support ksh as default because its what you prefer using.
                                  > >
                                  >
                                  > How come bash is linked to /bin/sh? So the sh is bash?
                                  > And somewher else sh is ksh. Hmmmm...
                                  >
                                  > And I don't want to *enforce* vim to do anything, it's just
                                  > seems to me more logical what I suggest.
                                  >
                                  > By the way, what *you* are defending? *Your* bash?
                                  > Note, not a hair will change for you if ksh is the default.
                                  > You'll still have to define is_bash if you want to be in sync.
                                  > I am suggesting something that should leave bash users in peace.
                                  > Got it?
                                  >
                                  > > i know people that uses csh, tcsh also ksh and whatever but i think
                                  > > its the best way to keep that as default whats used out of scratch
                                  > > on a majority of these distributions.
                                  >
                                  > The Linux contains lots of stuff, even some release alpha vim 6.0
                                  > with it and distributors don't even get a red face.
                                  > That's not an argument.
                                  >
                                  > ---Zdenek
                                • Ali Akcaagac
                                  ... i dont like beeing insulted by people i dont know. others already replied to you and told you, that you were wrong so i gonna leave it as it is. thank you
                                  Message 16 of 29 , Jul 27, 2001
                                  • 0 Attachment
                                    On 2001.07.27 18:42:41 +0200 Zdenek Sekera wrote:
                                    > > no not true.. please inform yourself.
                                    > >
                                    > > unix != linux != bsd != (vms, windows, amigaos, beos and whatever)
                                    > >
                                    >
                                    > Man grow up! Tulip != rose != ...right?
                                    > And Mandrake != RH != Suse != ...
                                    > How far will you split the hair?
                                    > We shouldn't be talking on that level.

                                    i dont like beeing insulted by people i dont know. others
                                    already replied to you and told you, that you were wrong so
                                    i gonna leave it as it is.

                                    thank you for your reply.

                                    --
                                    Name....: Ali Akcaagac
                                    Status..: Student Of Computer & Economic Science
                                    E-Mail..: mailto:ali.akcaagac@...-wilhelmshaven.de
                                    WWW.....: http://www.fh-wilhelmshaven.de/~akcaagaa
                                  • Zdenek Sekera
                                    ... Sorry if you felt insulted, that wasn t my intention. ... I don t think so, they disagree, isn t that important part of discussion? ... Fine with me. ...
                                    Message 17 of 29 , Jul 27, 2001
                                    • 0 Attachment
                                      Ali Akcaagac wrote:
                                      >
                                      > On 2001.07.27 18:42:41 +0200 Zdenek Sekera wrote:
                                      > > > no not true.. please inform yourself.
                                      > > >
                                      > > > unix != linux != bsd != (vms, windows, amigaos, beos and whatever)
                                      > > >
                                      > >
                                      > > Man grow up! Tulip != rose != ...right?
                                      > > And Mandrake != RH != Suse != ...
                                      > > How far will you split the hair?
                                      > > We shouldn't be talking on that level.
                                      >
                                      > i dont like beeing insulted by people i dont know.

                                      Sorry if you felt insulted, that wasn't my intention.

                                      > others
                                      > already replied to you and told you, that you were wrong so

                                      I don't think so, they disagree, isn't that important part
                                      of discussion?

                                      > i gonna leave it as it is.
                                      >

                                      Fine with me.

                                      > thank you for your reply.

                                      Likewise.

                                      ---Zdenek
                                    • Zdenek Sekera
                                      Charles E. Campbell wrote: ... Yes, that would be nice, but they don t as you know ;-( ... VERY true. ... Well, in the current scheme (and *suppose* .profile
                                      Message 18 of 29 , Jul 27, 2001
                                      • 0 Attachment
                                        "Charles E. Campbell" wrote:
                                        ...
                                        > I have to agree that if a script is expecting to run as a bash script it
                                        > should say so (#! /bin/bash) or as a ksh script it should say so (#!
                                        > /bin/ksh), even though /bin/sh may be linked to one or the other.

                                        Yes, that would be nice, but they don't as you know ;-(

                                        > However, especially with Linux, there are users who don't know that
                                        > /bin/sh isn't real sh and don't even know they have an option.
                                        >

                                        VERY true.

                                        > One problem: what to assume about <.profile>. The startup script
                                        > doesn't let us know for sure which shell is intended; I don't think
                                        > I've ever seen a #!... construct at the top of a <.profile>, for
                                        > example.
                                        >

                                        Well, in the current scheme (and *suppose* .profile exists only for
                                        sh or ksh, other shells have startup files with different names, right?)
                                        if the .profile is for:

                                        shell is_kornshell sh default ksh default (ignores
                                        is_kornshell)
                                        sh 0 OK OK
                                        sh 1 OK OK
                                        ksh 0 errors OK
                                        ksh 1 OK OK

                                        Wouldn't it make it better ?

                                        > I think having the default be Bourne shell helps illuminate this
                                        > matter for folks, because they have to choose is_kornshell or is_bash
                                        > or put up with lots of Error highlighting.
                                        >

                                        I guess you'll be the first one to agree that it is *very* difficult
                                        to have the syntax highlighting replace the real parser.
                                        I certainly wouldn't rely on it anyway.

                                        > Personally, I use pdksh under Linux, bash under Cygwin, and ksh on my
                                        > (old) SGI. Ah, well, I'm not politically correct anyway, so I favor
                                        > keeping Bourne shell as default.

                                        Maybe that's fine it it satisfies majority.

                                        ---Zdenek
                                      • Zdenek Sekera
                                        ... Absolutely. That s a choice, too. I just think overall there are more ksh than bash (*feeling* from comp.unix.shell, not a well based fact).
                                        Message 19 of 29 , Jul 27, 2001
                                        • 0 Attachment
                                          Wichert Akkerman wrote:
                                          >
                                          > Previously Zdenek Sekera wrote:
                                          > > Wouldn't it make it better ?
                                          >
                                          > One could make the same table for bash though.
                                          >

                                          Absolutely. That's a choice, too.

                                          I just think overall there are more ksh than bash
                                          (*feeling* from comp.unix.shell, not a well based
                                          fact).

                                          ---Zdenek
                                        • Zdenek Sekera
                                          ... But the comparison doesn t quite cut it because other big editor(s) have several other (also very active) groups, com.unix.shell has one (at least I know
                                          Message 20 of 29 , Jul 27, 2001
                                          • 0 Attachment
                                            Wichert Akkerman wrote:
                                            >
                                            > Previously Zdenek Sekera wrote:
                                            > > I just think overall there are more ksh than bash
                                            > > (*feeling* from comp.unix.shell, not a well based
                                            > > fact).
                                            >
                                            > If you use that kind of statistics then feeling by comp.editors 99% of
                                            > all people use vim as their editor :)
                                            >

                                            :-) wouldn't that be great?

                                            But the comparison doesn't quite cut it because other big editor(s)
                                            have several other (also very active) groups, com.unix.shell
                                            has one (at least I know of one only), so if you factor that
                                            out, you get a different *feeling*. But I am *not* overestimating
                                            my statistics in any way (as I tried to indicate).

                                            ---Zdenek
                                          • Thomas Köhler
                                            On Fri, Jul 27, 2001 at 06:33:26PM +0200, Zdenek Sekera wrote: [...] ... Uhm. Interesting. Now a look on my Debian GNU/Linux box: # ls -l
                                            Message 21 of 29 , Jul 27, 2001
                                            • 0 Attachment
                                              On Fri, Jul 27, 2001 at 06:33:26PM +0200,
                                              Zdenek Sekera <zs@...> wrote:
                                              [...]
                                              > > This is not a thorough investigation, though. I have not tested them
                                              > > all for ksh features.
                                              > >
                                              > > The Solaris one, at least, is not too happy about a few constructs;
                                              > > off the top of my head:
                                              > ...
                                              >
                                              > I really can't, I don't have a ready access to other systems from
                                              > my office, but maybe the way SGI is doing may shed some light:
                                              >
                                              > $ cd /
                                              > $ ls -l /bin/*sh*
                                              >
                                              > /bin/bsh -> ../../sbin/bsh
                                              > /bin/ksh -> ../../sbin/sh
                                              > /bin/rksh -> ../../sbin/sh
                                              > /bin/sh -> ../../sbin/sh

                                              Uhm. Interesting. Now a look on my Debian GNU/Linux box:

                                              # ls -l /bin/*sh*
                                              -rwxr-xr-x 1 root root 412060 25. Apr 19:36 /bin/bash
                                              lrwxrwxrwx 1 root root 4 11. Jun 08:09 /bin/rbash -> bash
                                              lrwxrwxrwx 1 root root 4 11. Jun 08:09 /bin/sh -> bash

                                              > (I cutout the beginning of ls output and irrelevant files matching *sh*)

                                              I did that, too ;-)

                                              > Here the bsh is the Bourne shell, otherwise /bin/sh and /bin/ksh point
                                              > to the same executable

                                              Here, sh is in fact bash. And on other systems, sh may be ash, or even
                                              a standalone binary.

                                              > Now take this script (and call it 'whatsh') and execute, remember
                                              > Bourne shell has no 'print' statement, only echo:
                                              >
                                              > #!/bin/sh
                                              > print 1
                                              >
                                              > $ whatsh
                                              > 1 -> how come, the script was specified as /bin/sh ??? shoudln't
                                              > it fail?

                                              So your version of "sh" is buggy. So what? :-)

                                              [...]
                                              > One can talk and argue, but this is it: #!/bin/sh and #!/bin/ksh
                                              > are the same thing.

                                              ... on *your* system. Not on mine, and not on many other systems.

                                              > Specifying one or the other makes no difference.

                                              It does on my system, where ksh is the pdksh, while sh is bash.

                                              [...]
                                              > The rest of my claims about commercial unix's is from comp.unix.shell
                                              > but not all unix's do it the same way. But the general claim is has
                                              > become the default (with old sh still being available bsh/osh/...).

                                              Uhm. If I remember correctly, sh is not ksh on Solaris. But I don't
                                              have a solaris box handy to check it out right now...

                                              [...]
                                              > > > There is really no harm in that: the sh is a subset of ksh
                                              > > > (I know there are subtle differences in functionality of
                                              > > > no consequence to 99.999999% of mortals), the *pure* sh script
                                              > > > will work without a change in ksh.
                                              > > Same can be said (or at least is said of/expected from :-) bash, which
                                              > > is also a /bin/sh replacement for some.
                                              > I heard that (never used bash, I have Linux at home and the first
                                              > thing I did was to download ksh :-)!

                                              Some mini-distributions use ash or another sh-compatible shell, you
                                              don't need to stick to bash at all ;-)

                                              [...]
                                              > > > More: the ksh has now become a free software (at least for
                                              > > > home users).
                                              > > This, I think, has nothing to do with the syntax highlighting :-)
                                              > It does, you need more colors and more clever regexps :-) (Ask
                                              > Dr.Chip!)

                                              Well, you would need them also if ksh was closed source ;-)

                                              > But what lots of people believe, the real ksh (the *real* thing)
                                              > will become more popular with Linux community because it is
                                              > a very solid language foundation. Some argue that bash/zsh/etc
                                              > were really written (and made so similar with ksh !!!), because
                                              > the old ksh licence was expensive, that's the freeware vengence
                                              > against high prices, I guess).

                                              zsh was not only written as a ksh replacement (though it's very good
                                              at that), but adds *tons* of extra features.
                                              You might argue that zsh is what ksh was meant to be... but then
                                              again, ksh is far away from its goals ;-)

                                              [...]
                                              > So I am arguing: if the world is (mostly) ksh, why not vim by default?
                                              > And I know opinions may/will differ, that's OK.

                                              I don't think the world is mostly ksh. :-)
                                              I'd rather argue "the world is (mostly) bash" (no, I don't want to say
                                              this is good), just because linux hurries in getting used in a very
                                              widespread way (and sh defaults to bash on most linux distributions).

                                              > I can set it and forget it, but why?, when/if ksh is default, almost
                                              > nobody will be affected and lot will be happier (TM :-)).

                                              One could also argue that a script starting with "#!/bin/sh" should
                                              *not* contain features that are only in ksh or such. So it's not vim
                                              at fault for doing strange highlightning, but it's the programmer's
                                              fault for playing false tricks ;-)

                                              [...]
                                              > > sh.vim mostly deals with sh proper only, and I concider this a good
                                              > > thing. Too many of the argument (for my tase) could easily come from a
                                              > > bash camper.
                                              > That's home market, however, there are real-world companies that sell
                                              > well made scripts, only in ksh, never seen one in bash. I don't know
                                              > if it's an srgument, but still something to think about.

                                              Well, I see companies like IBM that ship a little installer written in
                                              ksh for DB/2, and not adding dependencies on pdksh on their packages.
                                              Then I ist there and think "those companies should fix their software
                                              anyways" :)

                                              > The bash comes with Linux surely because it was free and available
                                              > at the right momnet and GNU backed. Had ksh been free earlier,
                                              > the tulips may have grown different color :-)

                                              Maybe yes, maybe no. Perhaps bash just got that famous because some
                                              linux gurus have been using it at the very beginning ;-)

                                              > ---Zdenek

                                              Ciao,
                                              Thomas (using zsh)

                                              --
                                              Thomas Köhler Email: jean-luc@... | LCARS - Linux
                                              <>< WWW: http://jeanluc-picard.de | for Computers
                                              IRC: jeanluc | on All Real
                                              PGP public key available from Homepage! | Starships
                                            • rawlins@cs.umass.edu
                                              (computer1) [rawlins@... rawlins]$ uname -a SunOS ...cs.umass.edu 5.8 Generic_108528-06 sun4u sparc SUNW,Ultra-Enterprise [rawlins@... rawlins]$ ls /bin/*sh*
                                              Message 22 of 29 , Jul 27, 2001
                                              • 0 Attachment
                                                (computer1)

                                                [rawlins@... rawlins]$ uname -a
                                                SunOS ...cs.umass.edu 5.8 Generic_108528-06 sun4u sparc SUNW,Ultra-Enterprise
                                                [rawlins@... rawlins]$ ls /bin/*sh* -alS
                                                -r-xr-xr-x 1 root bin 516392 Jan 5 2000 /bin/bash
                                                -r-xr-xr-x 1 root bin 472788 Jan 5 2000 /bin/zsh
                                                -r-xr-xr-x 1 root bin 326320 Jan 8 2000 /bin/tcsh
                                                -r-xr-xr-x 3 root bin 200944 Apr 3 01:01 /bin/ksh
                                                -r-xr-xr-x 3 root bin 200944 Apr 3 01:01 /bin/pfksh
                                                -r-xr-xr-x 3 root bin 200944 Apr 3 01:01 /bin/rksh
                                                -r-xr-xr-x 2 root bin 159216 Apr 3 01:01 /bin/csh
                                                -r-xr-xr-x 2 root bin 159216 Apr 3 01:01 /bin/pfcsh
                                                -r-xr-xr-x 4 root root 95316 May 26 2000 /bin/jsh
                                                -r-xr-xr-x 4 root root 95316 May 26 2000 /bin/pfsh
                                                -r-xr-xr-x 4 root root 95316 May 26 2000 /bin/sh
                                                -rwxr-xr-x 1 root sys 30116 Dec 16 1999 /bin/showrev
                                                -r-sr-xr-x 1 root bin 8964 Jan 5 2000 /bin/rsh
                                                -r-xr-xr-x 17 root bin 131 Jan 5 2000 /bin/hash
                                                lrwxrwxrwx 1 root root 5 Mar 21 11:35 /bin/remsh -> ./rsh
                                                [rawlins@helios rawlins]$ ls -alS /usr/xpg4/bin/*sh*
                                                lrwxrwxrwx 1 root root 13 Mar 21 11:47 /usr/xpg4/bin/sh -> ../../bin/ksh

                                                The xpg4 directory (I think) is not in the path by default.

                                                and (computer2)

                                                [rawlins@... rawlins]$ uname -a
                                                OSF1 ...cs.umass.edu V4.0 878 alpha
                                                [rawlins@... rawlins]$ ls -alS /bin/*sh*
                                                -rwxr-xr-x 1 root system 688128 Sep 15 1997 /bin/bash
                                                -rwxr-xr-x 1 root system 598016 Sep 15 1997 /bin/zsh
                                                -rwxr-xr-x 1 root system 442368 Sep 15 1997 /bin/tcsh
                                                -rwxr-xr-x 2 bin bin 270336 Jan 6 1999 /bin/ksh
                                                -rwxr-xr-x 1 bin bin 253952 Jan 6 1999 /bin/csh
                                                -rwxr-xr-x 2 bin bin 131072 Jan 6 1999 /bin/Rsh
                                                -rwxr-xr-x 2 bin bin 131072 Jan 6 1999 /bin/sh
                                                -rws--x--x 1 root bin 24576 Jan 6 1999 /bin/rsh
                                                -rwxr-xr-x 2 bin bin 16384 Dec 9 1997 /bin/wishx
                                                -rwxr-xr-x 2 bin bin 16384 Dec 9 1997 /bin/tclsh
                                                -rwxr-xr-x 2 bin bin 16384 Dec 9 1997 /bin/wish
                                                -rws--x--x 3 root bin 16384 Dec 29 1997 /bin/chsh
                                                -rwxr-xr-x 1 bin bin 7787 Dec 29 1997 /bin/crashdc
                                                -rwxr-xr-x 1 bin bin 1507 Dec 29 1997 /bin/hash
                                                (removed some things which were clearly not shells)

                                                and you all know the answers for the rest, which are linux...

                                                On Fri, Jul 27, 2001 at 09:41:48PM +0200, Thomas Köhler wrote:
                                                > Uhm. If I remember correctly, sh is not ksh on Solaris. But I don't
                                                > have a solaris box handy to check it out right now...

                                                --
                                                http://mas.cs.umass.edu/~rawlins
                                                now playing: VNV Nation / Empires
                                                --
                                                There are some qualities-some incorporate things,
                                                That have a double life, life aptly made
                                              • Zdenek Sekera
                                                ... You missed the point you are yourself defending: Follow this logic: 1. bash, zsh ... are closer to ksh (or even better) the they are to sh 2. sh is the
                                                Message 23 of 29 , Jul 27, 2001
                                                • 0 Attachment
                                                  Thomas Köhler wrote:
                                                  >
                                                  ...
                                                  > >
                                                  > > $ whatsh
                                                  > > 1 -> how come, the script was specified as /bin/sh ??? shoudln't
                                                  > > it fail?
                                                  >
                                                  > So your version of "sh" is buggy. So what? :-)

                                                  :-)

                                                  ...

                                                  > zsh was not only written as a ksh replacement (though it's very good
                                                  > at that), but adds *tons* of extra features.
                                                  > You might argue that zsh is what ksh was meant to be... but then
                                                  > again, ksh is far away from its goals ;-)
                                                  >
                                                  > [...]
                                                  > > So I am arguing: if the world is (mostly) ksh, why not vim by default?
                                                  > > And I know opinions may/will differ, that's OK.
                                                  >
                                                  > I don't think the world is mostly ksh. :-)
                                                  > I'd rather argue "the world is (mostly) bash" (no, I don't want to say
                                                  > this is good), just because linux hurries in getting used in a very
                                                  > widespread way (and sh defaults to bash on most linux distributions).
                                                  >

                                                  You missed the point you are yourself defending:
                                                  Follow this logic:

                                                  1. bash, zsh ... are closer to ksh (or even better) the they are to sh
                                                  2. sh is the subset of all
                                                  3. when we highlight with default (sh), all will be wrong (to some
                                                  extent, some more some less)
                                                  4. we can help some (bash/ksh with b:is*, no help for zsh)

                                                  Given 1., wouldn't it be correct to expect that if ksh was the default,
                                                  much more of them would be *more right* out of the box, then now?
                                                  Not correct, just more right, wouldn't that be a step in the right
                                                  direction? Or if the bash was the default, wouldn't it be better for
                                                  many more cases then it is today?

                                                  > > I can set it and forget it, but why?, when/if ksh is default, almost
                                                  > > nobody will be affected and lot will be happier (TM :-)).
                                                  >
                                                  > One could also argue that a script starting with "#!/bin/sh" should
                                                  > *not* contain features that are only in ksh or such. So it's not vim
                                                  > at fault for doing strange highlightning, but it's the programmer's
                                                  > fault for playing false tricks ;-)
                                                  >
                                                  > [...]
                                                  ...
                                                  > > That's home market, however, there are real-world companies that sell
                                                  > > well made scripts, only in ksh, never seen one in bash. I don't know
                                                  > > if it's an srgument, but still something to think about.
                                                  >
                                                  > Well, I see companies like IBM that ship a little installer written in
                                                  > ksh for DB/2, and not adding dependencies on pdksh on their packages.
                                                  > Then I ist there and think "those companies should fix their software
                                                  > anyways" :)
                                                  >

                                                  They are more, and I doubt they will ever ship any in bash/zsh/...
                                                  Not at all because these are bad in any way (you know zsh, I don't),
                                                  but this is just a way things go. Everybody should fix its software,
                                                  that the only sure thing in this game...:-)

                                                  ...
                                                  > Maybe yes, maybe no. Perhaps bash just got that famous because some
                                                  > linux gurus have been using it at the very beginning ;-)

                                                  That could be true, too :-)

                                                  > Ciao,
                                                  > Thomas (using zsh)

                                                  Good for you!

                                                  To the rest: hey guys, let's stop it, it created too much excitement,
                                                  much more then I ever thought the subject is worth.

                                                  And I go on vac tonight.

                                                  Have a good time all!

                                                  Cheers!

                                                  ---Zdenek
                                                • Thomas Köhler
                                                  On Fri, Jul 27, 2001 at 10:20:14PM +0200, ... [...] ... Only when not called as sh . Makes a huge difference! ... Yes. ... No. In fact, all should be right!
                                                  Message 24 of 29 , Jul 27, 2001
                                                  • 0 Attachment
                                                    On Fri, Jul 27, 2001 at 10:20:14PM +0200,
                                                    Zdenek Sekera <zs@...> wrote:
                                                    > Thomas Köhler wrote:
                                                    [...]
                                                    > > zsh was not only written as a ksh replacement (though it's very good
                                                    > > at that), but adds *tons* of extra features.
                                                    > > You might argue that zsh is what ksh was meant to be... but then
                                                    > > again, ksh is far away from its goals ;-)
                                                    > >
                                                    > > [...]
                                                    > > > So I am arguing: if the world is (mostly) ksh, why not vim by default?
                                                    > > > And I know opinions may/will differ, that's OK.
                                                    > >
                                                    > > I don't think the world is mostly ksh. :-)
                                                    > > I'd rather argue "the world is (mostly) bash" (no, I don't want to say
                                                    > > this is good), just because linux hurries in getting used in a very
                                                    > > widespread way (and sh defaults to bash on most linux distributions).
                                                    > You missed the point you are yourself defending:
                                                    > Follow this logic:
                                                    >
                                                    > 1. bash, zsh ... are closer to ksh (or even better) the they are to sh

                                                    Only when not called as "sh". Makes a huge difference!

                                                    > 2. sh is the subset of all

                                                    Yes.

                                                    > 3. when we highlight with default (sh), all will be wrong (to some
                                                    > extent, some more some less)

                                                    No.
                                                    In fact, all should be right! If one is wrong, it doesn't work
                                                    correctly in sh-compatible mode and a bugreport should be filed
                                                    against it ;-)

                                                    > 4. we can help some (bash/ksh with b:is*, no help for zsh)

                                                    So, another point: Why help some and at the same time forget about
                                                    others?

                                                    > Given 1., wouldn't it be correct to expect that if ksh was the default,
                                                    > much more of them would be *more right* out of the box, then now?

                                                    No. bash would be highlighted wrong (incompatible to ksh), sh would be
                                                    wrong on Solaris, True64, FreeBSD, Linux, and probably others.

                                                    > Not correct, just more right, wouldn't that be a step in the right
                                                    > direction? Or if the bash was the default, wouldn't it be better for
                                                    > many more cases then it is today?

                                                    No.
                                                    If a shell script starts as "#!/bin/sh", it should be highlighted as
                                                    sh, as it is surely run by some Bourne shell - but it is not run by
                                                    some kind of ksh or bash on all systems (perhaps not even on most of
                                                    them).

                                                    [...]
                                                    > > Maybe yes, maybe no. Perhaps bash just got that famous because some
                                                    > > linux gurus have been using it at the very beginning ;-)
                                                    >
                                                    > That could be true, too :-)

                                                    I'd bet so ;-)

                                                    > > Ciao,
                                                    > > Thomas (using zsh)
                                                    >
                                                    > Good for you!

                                                    Yes, indeed, *very* good ;-)

                                                    > Cheers!
                                                    >
                                                    > ---Zdenek

                                                    Ciao,
                                                    Thomas

                                                    --
                                                    Thomas Köhler Email: jean-luc@... | LCARS - Linux
                                                    <>< WWW: http://jeanluc-picard.de | for Computers
                                                    IRC: jeanluc | on All Real
                                                    PGP public key available from Homepage! | Starships
                                                  • Matt
                                                    ... Since no one s pointed it out yet... This is from the bash man page: When invoked as sh, bash enters posix mode after the startup files are read. This
                                                    Message 25 of 29 , Jul 27, 2001
                                                    • 0 Attachment
                                                      On Fri, 27 Jul 2001 rawlins@... wrote:


                                                      > and you all know the answers for the rest, which are linux...

                                                      Since no one's pointed it out yet... This is from the bash man page: "When invoked as sh, bash enters posix mode after the startup files are read." This indicates that /bin/sh -> /bin/bash acts as a "real" POSIX Bourne. Am I mistaken? pdksh doesn't indicate whether it does the same. I kind of remember the "real" Korn having a POSIX mode enabled by default as "sh", as well. But I can't confirm at the moment.

                                                      I felt this was relevant to the conversation because most (nearly all?) Linux machines have their /bin/sh really being bash, and if my assumption is correct, between FreeBSD, Linux, Solaris, AIX, and Digital, (a huge percentage of the Unix-like market) vim would perform incorrect syntax highlighting of people's "portable" scripts.

                                                      No, vim isn't as good as a parser, but it helps me when I use ksh constructs in a script meant to be run as #!/bin/sh. Yes, I use ksh. Yes, I think assuming the world uses ksh as sh is stupid and naive. FWIW, I've met tcsh users with your mindset regarding /bin/sh. They too felt that /bin/sh should be their favorite shell. Needless to say /bin/sh was linked to tcsh. I'll not go into what happened after this... ;)

                                                      Also, almost every "recent" machine I use (even Solaris 8) has bash. Most don't have ksh. Either because it wasn't installed by default, or because the sysadmin didn't think anyone needed it. So when I admin machines, it's often the second thing to be installed (after vim, of course).

                                                      Just more pennies on the pile.

                                                      --Matt
                                                    • Zdenek Sekera
                                                      ... Call them as needed to show their good points. ... That s just not possible. if some shell has a syntax the sh doesn t it will not be highlighted correctly
                                                      Message 26 of 29 , Jul 27, 2001
                                                      • 0 Attachment
                                                        Thomas Köhler wrote:
                                                        >
                                                        ...
                                                        > > Follow this logic:
                                                        > >
                                                        > > 1. bash, zsh ... are closer to ksh (or even better) the they are to sh
                                                        >
                                                        > Only when not called as "sh". Makes a huge difference!
                                                        >

                                                        Call them as needed to show their good points.

                                                        > > 2. sh is the subset of all
                                                        >
                                                        > Yes.
                                                        >
                                                        > > 3. when we highlight with default (sh), all will be wrong (to some
                                                        > > extent, some more some less)
                                                        >
                                                        > No.
                                                        > In fact, all should be right! If one is wrong, it doesn't work
                                                        > correctly in sh-compatible mode and a bugreport should be filed
                                                        > against it ;-)
                                                        >

                                                        That's just not possible. if some shell has a syntax the sh doesn't
                                                        it will not be highlighted correctly with sh syntax package,
                                                        (how could it be?), maybe those statements won't be highlighted at
                                                        all, or will be marked as errors, don't know, but cannot be right.

                                                        And since all have some extensions over sh, they cannot be correctly
                                                        highlighted. I call this *wrong* for luck of better word.
                                                        I just don't think it can be called right.

                                                        There is no bug report to send since that cannot be a bug.
                                                        Apples and oranges are both good, not comparable though.
                                                        All lowest common denominator syntax should however be highlighted
                                                        correctly and the same everywhere, I think, shouldn't it?

                                                        What is sh-compatible mode? Do others (zsh, bash, ...) have some
                                                        parameter allowing running sh scripts strictly as Bourne shell
                                                        or what do you mean? I know ksh doesn't, it just runs it, no need
                                                        to say 'this is a sh script'.

                                                        > > 4. we can help some (bash/ksh with b:is*, no help for zsh)
                                                        >
                                                        > So, another point: Why help some and at the same time forget about
                                                        > others?
                                                        >

                                                        That's the case today: there is nothing for zsh and yet you say it
                                                        has more features *on top* of ksh.
                                                        I am trying to help more of them then they are helped today.
                                                        That follows from the fact that bash, zsh are more 'ksh' then 'sh'.

                                                        > > Given 1., wouldn't it be correct to expect that if ksh was the
                                                        > default,
                                                        > > much more of them would be *more right* out of the box, then now?
                                                        >
                                                        > No. bash would be highlighted wrong (incompatible to ksh), sh would be
                                                        > wrong on Solaris, True64, FreeBSD, Linux, and probably others.
                                                        >

                                                        None of them are ksh *compatible*, but as even you claim, they are close
                                                        or exceed ksh. Thre is more syntax commonality between ksh and *them*
                                                        then sh and *them*. I am not saying ksh can run them, but as far syntax
                                                        goes, they have a *reputation* (I can't claim knowing them all) of
                                                        being ksh'like, more than sh'like. If I am wrong then my argument
                                                        is, of course, moot, but so far all I hear is different.

                                                        ksh should highlight corretly sh scripts because it is a subset of
                                                        it (forget the little unimportant difference for now). If it doesn't
                                                        I'd think there is something wrong somewhere, must be.
                                                        I think it does.
                                                        And if sh is really sh on all you mentioned above, how could it be
                                                        that they are highlighted differently/wrongly? I just don't follow this.

                                                        > > Not correct, just more right, wouldn't that be a step in the right
                                                        > > direction? Or if the bash was the default, wouldn't it be better for
                                                        > > many more cases then it is today?
                                                        >
                                                        > No.
                                                        > If a shell script starts as "#!/bin/sh", it should be highlighted as
                                                        > sh, as it is surely run by some Bourne shell - but it is not run by
                                                        > some kind of ksh or bash on all systems (perhaps not even on most of
                                                        > them).

                                                        Fine, highlight it that way, sounds good. Note the 'if' that starts
                                                        the sentence.
                                                        What about those that have *no* #!/bin/... ? There are plenty.
                                                        These are cases when defaults help, when everything is defined,
                                                        there is no problem.

                                                        Maybe you have a point, though: shouldn't those that *don't say what
                                                        they are* be actually not highlighted at all? If they comeout B on W,
                                                        one would know info is missing. I am sure though that would be
                                                        inacceptable to all, because everybody would say: use this or that
                                                        (according to what is beliefs are). The choice is sh today.
                                                        It's not bad, no, I am trying to find out if there isn't a better
                                                        one, that would make more scripts look more right (since we know
                                                        a lot will be more-or-less not right). I thought ksh could be *the one*.
                                                        If somebody thinks bash *is it*, fine with me. But it seems to me
                                                        this very issue is not really on the plate, others are (not with you,
                                                        though).

                                                        That's all, no science!

                                                        ---Zdenek
                                                      • Matt
                                                        ... I have to agree here. ;) ... It s POSIX-compatible/Bourne shell mode. With most shells, it s simply the shell called as sh . I have a symlink in ~/bin
                                                        Message 27 of 29 , Jul 27, 2001
                                                        • 0 Attachment
                                                          On Fri, 27 Jul 2001, Zdenek Sekera wrote:

                                                          >
                                                          > Thomas Köhler wrote:

                                                          > > No.
                                                          > > In fact, all should be right! If one is wrong, it doesn't work
                                                          > > correctly in sh-compatible mode and a bugreport should be filed
                                                          > > against it ;-)
                                                          > >

                                                          I have to agree here. ;)

                                                          > What is sh-compatible mode? Do others (zsh, bash, ...) have some
                                                          > parameter allowing running sh scripts strictly as Bourne shell
                                                          > or what do you mean? I know ksh doesn't, it just runs it, no need
                                                          > to say 'this is a sh script'.

                                                          It's POSIX-compatible/Bourne shell mode. With most shells, it's simply the shell called as 'sh'. I have a symlink in ~/bin (which is first in my path) so that ~/bin/sh is /usr/local/bin/bash. It appears that calling ~/bin/sh acts just as /bin/sh does. (/bin/sh is ash on FreeBSD, as was pointed out earlier.)

                                                          > > > Given 1., wouldn't it be correct to expect that if ksh was the
                                                          > > default,
                                                          > > > much more of them would be *more right* out of the box, then now?
                                                          > >
                                                          > > No. bash would be highlighted wrong (incompatible to ksh), sh would be
                                                          > > wrong on Solaris, True64, FreeBSD, Linux, and probably others.
                                                          > >
                                                          >
                                                          > None of them are ksh *compatible*, but as even you claim, they are close
                                                          > or exceed ksh. Thre is more syntax commonality between ksh and *them*
                                                          > then sh and *them*. I am not saying ksh can run them, but as far syntax
                                                          > goes, they have a *reputation* (I can't claim knowing them all) of
                                                          > being ksh'like, more than sh'like. If I am wrong then my argument
                                                          > is, of course, moot, but so far all I hear is different.
                                                          >
                                                          > ksh should highlight corretly sh scripts because it is a subset of
                                                          > it (forget the little unimportant difference for now). If it doesn't
                                                          > I'd think there is something wrong somewhere, must be.
                                                          > I think it does.
                                                          > And if sh is really sh on all you mentioned above, how could it be
                                                          > that they are highlighted differently/wrongly? I just don't follow this.

                                                          They're more sh-like than ksh-like. Various degrees of original Bourne and various degrees of POSIXly-correctness. They'd be highlighted incorrectly by using ksh syntax in them. Which would then cause parse errors. Writing a ksh script with sh highlighting (sh == Bourne, BTW.) won't cause a parse error. Nor will it cause a parse error in bash, zsh, etc. It is also possible for ksh highlighting to highlight things that would cause parse errors in bash as correct. Lowest common denominator is the safest, here. Not the most powerful, but the safest. And most compatible. ;)

                                                          > What about those that have *no* #!/bin/... ? There are plenty.
                                                          > These are cases when defaults help, when everything is defined,
                                                          > there is no problem.

                                                          And Bourne is a good default.

                                                          >
                                                          > Maybe you have a point, though: shouldn't those that *don't say what
                                                          > they are* be actually not highlighted at all? If they comeout B on W,
                                                          > one would know info is missing. I am sure though that would be
                                                          > inacceptable to all, because everybody would say: use this or that
                                                          > (according to what is beliefs are). The choice is sh today.
                                                          > It's not bad, no, I am trying to find out if there isn't a better
                                                          > one, that would make more scripts look more right (since we know
                                                          > a lot will be more-or-less not right). I thought ksh could be *the one*.
                                                          > If somebody thinks bash *is it*, fine with me. But it seems to me
                                                          > this very issue is not really on the plate, others are (not with you,
                                                          > though).

                                                          "*The one*" should be Bourne. For the multitude of reasons stated by me, Thomas, and the others. (There WERE others interested in this, right? ;)

                                                          Vim should not go out of its way to assume what is "right" and "wrong" practice for scripts. By choosing a particular variant of the Bourne family, that's what would be happening. By choosing Bourne syntax, we'd be saying "Use what you like. We've provided the minimum you require to get the job done. You're welcome to enable the other things you need." That's a whole lot better than coming across as "Here's your source formatted as ksh. It's better."

                                                          Remember, all the other shells we're discussing are DERIVATIVES of Bourne. We should be using the parent tongue if we can't determine better.

                                                          --Matt
                                                        • Thomas Köhler
                                                          On Fri, Jul 27, 2001 at 11:18:46PM +0200, ... [...] ... Now, you don t have a /bin/sh that works like /bin/sh and wonder why /bin/sh compatible highlightning
                                                          Message 28 of 29 , Jul 28, 2001
                                                          • 0 Attachment
                                                            On Fri, Jul 27, 2001 at 11:18:46PM +0200,
                                                            Zdenek Sekera <zs@...> wrote:
                                                            > Thomas Köhler wrote:
                                                            [...]
                                                            > > > 2. sh is the subset of all
                                                            > >
                                                            > > Yes.
                                                            > >
                                                            > > > 3. when we highlight with default (sh), all will be wrong (to some
                                                            > > > extent, some more some less)
                                                            > >
                                                            > > No.
                                                            > > In fact, all should be right! If one is wrong, it doesn't work
                                                            > > correctly in sh-compatible mode and a bugreport should be filed
                                                            > > against it ;-)
                                                            >
                                                            > That's just not possible. if some shell has a syntax the sh doesn't
                                                            > it will not be highlighted correctly with sh syntax package,

                                                            ... and thus, it isn't sh-compatible and should not be in /bin/sh

                                                            > (how could it be?), maybe those statements won't be highlighted at
                                                            > all, or will be marked as errors, don't know, but cannot be right.


                                                            Now, you don't have a /bin/sh that works like /bin/sh and wonder why
                                                            /bin/sh compatible highlightning doesn't work correctly? :-)

                                                            > And since all have some extensions over sh, they cannot be correctly
                                                            > highlighted. I call this *wrong* for luck of better word.
                                                            > I just don't think it can be called right.

                                                            It is right assuming that /bin/sh is /bin/sh.

                                                            > There is no bug report to send since that cannot be a bug.

                                                            Of course it is. /bin/sh doesn't work like /bin/sh should work, thus
                                                            it is buggy...

                                                            > Apples and oranges are both good, not comparable though.
                                                            > All lowest common denominator syntax should however be highlighted
                                                            > correctly and the same everywhere, I think, shouldn't it?

                                                            Yes, right.

                                                            > What is sh-compatible mode? Do others (zsh, bash, ...) have some
                                                            > parameter allowing running sh scripts strictly as Bourne shell
                                                            > or what do you mean?

                                                            if you symlink bash to sh and run it as sh (either via a script that
                                                            starts as "/bin/sh", or via "sh script"), it will run in sh-compatible
                                                            mode, and turns off many extra features. Same applies for zsh. (In
                                                            fact, zsh will also limit itself to a subset of features when envoked
                                                            as ksh, too ;-)

                                                            > I know ksh doesn't, it just runs it, no need to say 'this is a sh
                                                            > script'.

                                                            Bad practice.
                                                            You start developing Bourne shell scripts, think that they are
                                                            portable (you tested them using /bin/sh, didn't you?), then switch to
                                                            Solaris, FreeBSD, True64 or Linux and see - oops, all of your scripts
                                                            don't work.
                                                            Invoking the shell as /bin/sh should lead to a sh compatible shell,
                                                            not a (however powerful) superset.

                                                            Same applies for vi, btw: vi <something> should lead to vi in true
                                                            compatible mode, and not run vim in full-featured mode with syntax
                                                            highlightning enabled etc.

                                                            > > > 4. we can help some (bash/ksh with b:is*, no help for zsh)
                                                            > > So, another point: Why help some and at the same time forget about
                                                            > > others?
                                                            >
                                                            > That's the case today: there is nothing for zsh and yet you say it
                                                            > has more features *on top* of ksh.

                                                            Sure it has. You can invoke it as ksh if you want to limit it to ksh
                                                            behaviour, though ;-)

                                                            > I am trying to help more of them then they are helped today.
                                                            > That follows from the fact that bash, zsh are more 'ksh' then 'sh'.

                                                            zsh is sh when invoked as sh, same applies for bash.
                                                            When editing zsh scripts, there's zsh.vim which highlights them in a
                                                            zsh specific way.

                                                            > > > Given 1., wouldn't it be correct to expect that if ksh was the
                                                            > > > default,
                                                            > > > much more of them would be *more right* out of the box, then now?
                                                            > > No. bash would be highlighted wrong (incompatible to ksh), sh would be
                                                            > > wrong on Solaris, True64, FreeBSD, Linux, and probably others.
                                                            > None of them are ksh *compatible*,

                                                            See? But all of them are /bin/sh on some system or the other.

                                                            > but as even you claim, they are close or exceed ksh.

                                                            ash or Solaris sh or True64 sh do *NOT* exceed ksh.

                                                            > Thre is more syntax commonality between ksh and *them*
                                                            > then sh and *them*.

                                                            Wrong.

                                                            > I am not saying ksh can run them, but as far syntax
                                                            > goes, they have a *reputation* (I can't claim knowing them all) of
                                                            > being ksh'like, more than sh'like. If I am wrong then my argument
                                                            > is, of course, moot, but so far all I hear is different.

                                                            Sorry, but you *are* wrong here.

                                                            [...]
                                                            > And if sh is really sh on all you mentioned above, how could it be
                                                            > that they are highlighted differently/wrongly? I just don't follow this.

                                                            They would be highlighted wrongly if ksh specific options were in
                                                            effect. That's my point.

                                                            > > > Not correct, just more right, wouldn't that be a step in the right
                                                            > > > direction? Or if the bash was the default, wouldn't it be better for
                                                            > > > many more cases then it is today?
                                                            > > No.
                                                            > > If a shell script starts as "#!/bin/sh", it should be highlighted as
                                                            > > sh, as it is surely run by some Bourne shell - but it is not run by
                                                            > > some kind of ksh or bash on all systems (perhaps not even on most of
                                                            > > them).
                                                            > Fine, highlight it that way, sounds good. Note the 'if' that starts
                                                            > the sentence.
                                                            > What about those that have *no* #!/bin/... ? There are plenty.

                                                            First of all, this is bad practice. And on most systems, shell scripts
                                                            not starting with "#!" will be handed over to - plain sh.

                                                            > Maybe you have a point, though: shouldn't those that *don't say what
                                                            > they are* be actually not highlighted at all? If they comeout B on W,
                                                            > one would know info is missing.

                                                            Why? Unix defaults to /bin/sh in that case, so vim shouldn't do
                                                            anything different.

                                                            > I am sure though that would be inacceptable to all, because
                                                            > everybody would say: use this or that (according to what is beliefs
                                                            > are). The choice is sh today.

                                                            As it should be.

                                                            > It's not bad, no, I am trying to find out if there isn't a better
                                                            > one, that would make more scripts look more right (since we know
                                                            > a lot will be more-or-less not right). I thought ksh could be *the one*.

                                                            I think you're wrong with your thoughts then ;-)

                                                            > If somebody thinks bash *is it*, fine with me.

                                                            I think sh is it.

                                                            > But it seems to me this very issue is not really on the plate,
                                                            > others are (not with you, though).

                                                            :-)

                                                            > ---Zdenek

                                                            Ciao,
                                                            Thomas

                                                            --
                                                            Thomas Köhler Email: jean-luc@... | LCARS - Linux
                                                            <>< WWW: http://jeanluc-picard.de | for Computers
                                                            IRC: jeanluc | on All Real
                                                            PGP public key available from Homepage! | Starships
                                                          • Charles E. Campbell
                                                            ... Depends on whether shell XYZ supports .XYZ_profile; in particular, ksh doesn t. ... Csh isn t a problem; it uses Regards, C Campbell -- Charles E
                                                            Message 29 of 29 , Jul 30, 2001
                                                            • 0 Attachment
                                                              Thus saith Bohdan Vlasyuk:
                                                              > On Fri, Jul 27, 2001 at 11:38:47AM -0400, Charles E. Campbell wrote:
                                                              > > One problem: what to assume about <.profile>.

                                                              > I guess there are separate profiles for each shell. E.g. on all RH
                                                              > distributions I've seen, there's no .profile, yet there's
                                                              > .bash_profile for bash. So why there can't be .XYZ_profile for XYZ ?

                                                              Depends on whether shell XYZ supports .XYZ_profile; in particular,
                                                              ksh doesn't.

                                                              > I think keeping .profile as sh-compatible, and tweak .bash_profile for
                                                              > bash would be wise choice, so that no csh would complain on your
                                                              > .profile.

                                                              Csh isn't a problem; it uses <.login>


                                                              Regards,
                                                              C Campbell

                                                              --
                                                              Charles E Campbell, Jr, PhD _ __ __
                                                              Goddard Space Flight Center / /_/\_\_/ /
                                                              cec@... /_/ \/_//_/
                                                              PGP public key: http://www.erols.com/astronaut/pgp.html
                                                            Your message has been successfully submitted and would be delivered to recipients shortly.