ksh vs bash

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

ksh vs bash

Default User-4
I just know I'm going to regret asking this, but . . .
why does OpenBSD have ksh as the default shell, rather than bash?

Also, what ever happened to the statically-compiled bash that used to be
available in OpenBSD packages?  

BTW, thanks for making ksh the default shell for root - IMHO much easier
to learn than csh, especially if you're used to bash.  

No flames, please. Just honest thoughtful discussion.  

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Greg Thomas-3
On 8/26/06, Default User <[hidden email]> wrote:
> I just know I'm going to regret asking this, but . . .
> why does OpenBSD have ksh as the default shell, rather than bash?
>
...
> No flames, please. Just honest thoughtful discussion.

Sure, dude.  I take it you haven't figured out where the archives are?

Greg

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Sam Chill
In reply to this post by Default User-4
On 8/27/06, Default User <[hidden email]> wrote:
> I just know I'm going to regret asking this, but . . .
> why does OpenBSD have ksh as the default shell, rather than bash?
ksh is free while bash is GNU licensed. If it is possible to use free
(bsd, public domain, etc) software it is preferable. ksh does most
everything bash does too, so it doesn't seem like a loss.
Good day,
Sam

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

mal content
In reply to this post by Default User-4
On 27/08/06, Default User <[hidden email]> wrote:
> why does OpenBSD have ksh as the default shell, rather than bash?
>
> ...
>
> No flames, please. Just honest thoughtful discussion.
>

That's probably not a question that's going to result in honest,
thoughtful discussion.

MC

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

STeve Andre'
In reply to this post by Default User-4
On Sunday 27 August 2006 00:02, Default User wrote:

> I just know I'm going to regret asking this, but . . .
> why does OpenBSD have ksh as the default shell, rather than bash?
>
> Also, what ever happened to the statically-compiled bash that used to be
> available in OpenBSD packages?
>
> BTW, thanks for making ksh the default shell for root - IMHO much easier
> to learn than csh, especially if you're used to bash.
>
> No flames, please. Just honest thoughtful discussion.

Bash is a corpulant pig.  Even the static version of it is fatter than
ksh.  So if the default for root is reasonable, why not make it the
default, period?

You should look in the archives for stuff like this.  Usually with some
digging you'll find previous discussions on things.  At least make the
effort first, before asking.

--STeve Andre'

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Woodchuck-2
In reply to this post by Default User-4
On Sat, 26 Aug 2006, Default User wrote:

> I just know I'm going to regret asking this, but . . .
> why does OpenBSD have ksh as the default shell, rather than bash?
>
> Also, what ever happened to the statically-compiled bash that used to be
> available in OpenBSD packages?  
>
> BTW, thanks for making ksh the default shell for root - IMHO much easier
> to learn than csh, especially if you're used to bash.  
>
> No flames, please. Just honest thoughtful discussion.  

A better question is "why do others use bash instead of a more
standards-compliant shell"?

I suspect the answer might be that ksh was a little late being freed
(the original ksh, not pdksh).

And besides, bash isn't yet free, and probably never will be, and
there's enough GPL code around BSD already.

Bash is not good (not portable) for scripting, and the interactive
bits are not compelling reasons to use it.  It has some annoying
differences from sh(1), and in some cases implements SysV ideas, and
this ain't SysV.  (Consider the bash internal "echo" command for
an example.  Compare 'echo "\nfoo"'  and '/bin/echo "\nfoo"'.  This
whole internal command thing is a bit irritating and possibly
bad.  Very bad for root.  Rule for root: no surprises.)

Perl has obviated the need for some sort of interactive interpreted
system language.  Bash has some new and expanded features, but not
enough to make its use compelling.

Or so I think.

Dave
--
Experience runs an expensive school, but fools will learn in no other.
                       -- Benjamin Franklin

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Matthias Kilian
In reply to this post by Default User-4
On Sat, Aug 26, 2006 at 11:02:32PM -0500, Default User wrote:
> I just know I'm going to regret asking this, but . . .
> why does OpenBSD have ksh as the default shell, rather than bash?

Size, speed[1], license (PD vs. GPL), possibly standard conformance.

> Also, what ever happened to the statically-compiled bash that used to be
> available in OpenBSD packages?  

http://marc.theaimsgroup.com/?l=openbsd-ports&m=113442995921740&w=2

Ciao,
        Kili

[1] Try this in ksh and bash:

        jot 1000000 |
        while read foo; do
                :
        done

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Martin Toft-2
In reply to this post by Sam Chill
Sam Chill wrote:
> ksh does most everything bash does too, so it doesn't seem like a loss.

FWIW, I miss a couple of features in ksh and consider to switch (back)
to bash:

- When using tab completion, and you press tab two times to get a list
of possibilities, ksh doesn't use less/more to present the possibilities
(i.e. they just scroll by and I have to use shift+page-up).

- When writing long commands, bash uses multiple lines to let me see the
whole command, whereas ksh "scrolls" the line horizontally, only showing
me a part of the command at a time. This is of course a matter of taste,
but I like the method of bash.

- In ksh, history is not automatically set up (but this is not a missing
feature, since you can set it up yourself).

I'm very eager to hear from anyone, who got workarounds/solutions to the
above... but please, don't let my post disturb the main topic of the thread.

/Martin

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Martin Toft-2
Martin Toft wrote:
> FWIW, I miss a couple of features in ksh and consider to switch (back)
> to bash:

I forgot one:

- I miss the "for (( expr1 ; expr2 ; expr3 )) ; do list ; done"
construct. Of course, using e.g. jot, it is possible to do semantically
equivalent stuff.

/Martin

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Joachim Schipper
In reply to this post by Martin Toft-2
On Sun, Aug 27, 2006 at 11:22:13AM +0200, Martin Toft wrote:
> Sam Chill wrote:
> >ksh does most everything bash does too, so it doesn't seem like a loss.
>
> FWIW, I miss a couple of features in ksh and consider to switch (back)
> to bash:
>
> - When using tab completion, and you press tab two times to get a list
> of possibilities, ksh doesn't use less/more to present the possibilities
> (i.e. they just scroll by and I have to use shift+page-up).

This is, IMNSHO, preferable - you don't have to exit less/more.

> - When writing long commands, bash uses multiple lines to let me see the
> whole command, whereas ksh "scrolls" the line horizontally, only showing
> me a part of the command at a time. This is of course a matter of taste,
> but I like the method of bash.

ksh's is much simpler, though; ksh is, due to such decisions, much
lighter than bash.

Of course, if you're running KDE anyway, this doesn't matter.

> - In ksh, history is not automatically set up (but this is not a missing
> feature, since you can set it up yourself).

So set it up yourself.

> I'm very eager to hear from anyone, who got workarounds/solutions to the
> above... but please, don't let my post disturb the main topic of the thread.

                Joachim

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Randal L. Schwartz
In reply to this post by Woodchuck-2
>>>>> "Woodchuck" == Woodchuck  <[hidden email]> writes:

Woodchuck> Perl has obviated the need for some sort of interactive interpreted
Woodchuck> system language.  Bash has some new and expanded features, but not
Woodchuck> enough to make its use compelling.

Since discovering Perl, the longest thing I ever write in any shell
script is .profile, and that's annoying enough, and making me wish
I could just cut the cord and use Perl as my login shell.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Nick Holland
In reply to this post by Martin Toft-2
Martin Toft wrote:

> Sam Chill wrote:
>> ksh does most everything bash does too, so it doesn't seem like a
>> loss.
>
> FWIW, I miss a couple of features in ksh and consider to switch
> (back) to bash:
>
> - When using tab completion, and you press tab two times to get a
> list of possibilities, ksh doesn't use less/more to present the
> possibilities (i.e. they just scroll by and I have to use
> shift+page-up).

wow.  I don't recall ever having hit 'tab' in ksh, got more than a
screen full of possibilities, and actually had wanted to scroll back up
and find the ONE thing I was looking for.  If I got that many responses,
I didn't ask the right question.  I'd simply refine my question...

The relatively few times I've used bash, I found its tab completion far
less intuitive and useful than OpenBSD's ksh.  So, I'm going to say this
is probably a "What I'm/you're used to" thing.

(that goes for invoking more/less when unexpected...that irritates the
heck out of me on Linux).

'Course, I do a lot of work from xterms with a nice wheel mouse, so
scrolling back up to see what I missed is very painless, and automatic.

> - When writing long commands, bash uses multiple lines to let me see
> the whole command, whereas ksh "scrolls" the line horizontally, only
> showing me a part of the command at a time. This is of course a
> matter of taste, but I like the method of bash.

I will admit, I'm not overly fond of ksh's long-line handling,
'specially in an xterm which I've made huge just so I could see the
whole line.  So, maybe I'll give bash a point on this one, not having
even seen what it does.

> - In ksh, history is not automatically set up (but this is not a
> missing feature, since you can set it up yourself).

THANK GOODNESS.
What an idiotic thing to leave lying around...a list of commands
recently run by that user, on by default.  What the hell were they
thinking?  Ignore the bloat, ignore the non-standards, ignore the
license, this makes bash a non-contender in my book by itself.

[from another note]
> - I miss the "for (( expr1 ; expr2 ; expr3 )) ; do list ; done"
> construct. Of course, using e.g. jot, it is possible to do
> semantically equivalent stuff.

You can complain that the standard sh scripting language didn't contain
that construct, but it is over, it didn't.  Now...do you wish to write
portable sh scripts or linux-based bash-only scripts?  Use non-standard
stuff like that, you aren't doing portable code...for no valid reason at
all.  If you want to write to only one platform, Windows has a larger
user base...



To a large extent, it depends on what you are used to.
It amuses me to see people who spend a lot of time to make one OS look
like another, such as running bash on OpenBSD or a window manager that
looks suspiciously like Windows on a Unix machine (or making a Windows
XP machine look like a Windows 2000 machine!).

Almost every OS has features that cause the developers to think it is
the right way to do things, and most of those developers do far more
with their machines than you do.  I've found it more useful to learn
"the way" of whatever OS I'm working with rather than trying to force it
to look like what I'm used to.  Very, very rarely will you EVER see a
real productivity gain equal to the time spent trying to make A look
like B, and then repeating it for every install, for every update.

(I will admit, on OpenBSD machines I used the root account on, I did
tend to change csh to ksh back when csh was the standard root shell. :)


> I'm very eager to hear from anyone, who got workarounds/solutions to
> the above... but please, don't let my post disturb the main topic of
> the thread.

too late, the main topic was already disturbed.  :)


Nick.

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Joachim Schipper
In reply to this post by Randal L. Schwartz
On Sun, Aug 27, 2006 at 09:14:12AM -0700, Randal L. Schwartz wrote:
> >>>>> "Woodchuck" == Woodchuck  <[hidden email]> writes:
>
> Woodchuck> Perl has obviated the need for some sort of interactive interpreted
> Woodchuck> system language.  Bash has some new and expanded features, but not
> Woodchuck> enough to make its use compelling.
>
> Since discovering Perl, the longest thing I ever write in any shell
> script is .profile, and that's annoying enough, and making me wish
> I could just cut the cord and use Perl as my login shell.

I'm almost certain you can. It still isn't a good thing to use for root,
for obvious reasons (and a statically linked perl is a little too big).

                Joachim

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

smith-16
In reply to this post by Woodchuck-2
When I started using OpenBSD, I got tired of having to install Bash all the
time so I just stuck with ksh.  That was several years ago.  I don't know much
about shell programming nor do I do any configuring with ksh.

Now everytime I use linux, I find bash very annoying.  I don't know why, I
just do.  I guess a lot of the annoyance has to do with tab completion.

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Dan Harnett
In reply to this post by Martin Toft-2
On Sun, Aug 27, 2006 at 11:22:13AM +0200, Martin Toft wrote:

> Sam Chill wrote:
> >ksh does most everything bash does too, so it doesn't seem like a loss.
>
> FWIW, I miss a couple of features in ksh and consider to switch (back)
> to bash:
>
> - When using tab completion, and you press tab two times to get a list
> of possibilities, ksh doesn't use less/more to present the possibilities
> (i.e. they just scroll by and I have to use shift+page-up).
>
> - When writing long commands, bash uses multiple lines to let me see the
> whole command, whereas ksh "scrolls" the line horizontally, only showing
> me a part of the command at a time. This is of course a matter of taste,
> but I like the method of bash.


These are features of readline, which bash uses.  You can toggle them on
and off in your ~/.inputrc file.  I tend to prefer pdksh and usually
configure readline to mimic it when I have to use bash.

  set page-completions off
  set horizontal-scroll-mode on


One feature that is very annoying with bash is how it handles $BASH_ENV
and $ENV.  Some of bash's behavior appears to be specified at compile
time, and I don't think I have ever seen two systems with bash compiled
the same way.  You usually find something like this snippet in the
default installed .profile (or .bash_profile) on linux systems:

  if [ -f ~/.bashrc ] ; then
    . ~/.bashrc
  fi

What is annoying about this is that .bashrc isn't read everytime a shell
is started, only at login.  So, some other programs may need extra hacks
to read your environment file correctly (ie.  setting XTerm*loginShell
to true).

I find this so much more simple and it always works consistently for
pdksh.

  export ENV=~/.kshrc

I don't have to do funny tricks in various programs to simulate a login
shell.  I can use su to change privileges and keep my environment much
more conveniently.  For bash, you have to figure out how it was compiled
first.  No thanks.

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

danno
In reply to this post by Martin Toft-2
> - When using tab completion, and you press tab two times to get a list
> of possibilities, ksh doesn't use less/more to present the
possibilities
> (i.e. they just scroll by and I have to use shift+page-up).
>

Less/more works just fine for me in ksh... or maybe I installed
something I've forgotten about to add this functionality?

# cat /var/www/conf/httpd.conf | less

Works.

Dan Farrell

Reply | Threaded
Open this post in threaded view
|

Re: ksh vs bash

Adam-29
Dan Farrell <[hidden email]> wrote:

> > - When using tab completion, and you press tab two times to get a list
> > of possibilities, ksh doesn't use less/more to present the
> possibilities
> > (i.e. they just scroll by and I have to use shift+page-up).
> >
>
> Less/more works just fine for me in ksh... or maybe I installed
> something I've forgotten about to add this functionality?
>
> # cat /var/www/conf/httpd.conf | less

1. Using cat is not tab completion.
2. Don't cat a file just to pipe it to another program that can read
the file itself. (use less /var/www/conf/httpd.conf)

Adam