Discussion:
ksh vs bash
Default User
2006-08-27 04:02:32 UTC
Permalink
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.
Greg Thomas
2006-08-27 05:15:09 UTC
Permalink
Post by Default User
I just know I'm going to regret asking this, but . . .
why does OpenBSD have ksh as the default shell, rather than bash?
...
Post by Default User
No flames, please. Just honest thoughtful discussion.
Sure, dude. I take it you haven't figured out where the archives are?

Greg
Sam Chill
2006-08-27 05:15:54 UTC
Permalink
Post by Default User
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
Martin Toft
2006-08-27 09:22:13 UTC
Permalink
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
Martin Toft
2006-08-27 09:29:58 UTC
Permalink
Post by Martin Toft
FWIW, I miss a couple of features in ksh and consider to switch (back)
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
Joachim Schipper
2006-08-27 13:26:24 UTC
Permalink
Post by Martin Toft
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)
- 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.
Post by Martin Toft
- 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.
Post by Martin Toft
- 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.
Post by Martin Toft
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
Nick Holland
2006-08-27 16:29:54 UTC
Permalink
Post by Martin Toft
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
- 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.
Post by Martin Toft
- 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.
Post by Martin Toft
- 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]
Post by Martin Toft
- 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. :)
Post by Martin Toft
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.
Dan Harnett
2006-08-28 13:33:43 UTC
Permalink
Post by Martin Toft
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)
- 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.
Dan Farrell
2006-08-29 13:45:54 UTC
Permalink
Post by Martin Toft
- 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
Post by Martin Toft
(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
Adam
2006-08-29 16:07:56 UTC
Permalink
Post by Martin Toft
Post by Martin Toft
- 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
Post by Martin Toft
(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

mal content
2006-08-27 05:18:41 UTC
Permalink
Post by Default User
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
STeve Andre'
2006-08-27 05:24:39 UTC
Permalink
Post by Default User
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'
Woodchuck
2006-08-27 05:52:16 UTC
Permalink
Post by Default User
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
Randal L. Schwartz
2006-08-27 16:14:12 UTC
Permalink
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
<***@stonehenge.com> <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!
Joachim Schipper
2006-08-27 16:34:32 UTC
Permalink
Post by Randal L. Schwartz
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
smith
2006-08-27 19:27:56 UTC
Permalink
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.
Matthias Kilian
2006-08-27 08:50:46 UTC
Permalink
Post by Default User
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.
Post by Default User
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
Continue reading on narkive:
Loading...