Whats the difference between ksh and bash?
what are significant differences between ksh and bash? I read somewhere that ksh is proprietary shell and bash is completely open source.
|
I actually had to look up some features between various shells recently that I don't frequently use and ran into this chart, it might answer some of your questions at least on the technical aspects.
http://www.unix.com/answers-frequent...nt-shells.html |
There are open source versions of ksh. You can run it on Linux (we do). There was an older ksh for OSS called pdksh that acted somewhat differently than the newer ksh and that may be why folks didn't like it.
There are several differences - bash has most of what ksh does and then some extra stuff. A script written to run in ksh would likely run in bash just fine. A lot of the differences deal with math, variables, arrays, functions etc... - bash just seems to have a hell of lot more of this than ksh One thing that originally kept me from using bash over ksh was that I liked the vi style editing that ksh used by default but not bash. However, you can type "set -o vi" in bash to get that same functionality. |
Thanks jlightner
@rweaver - The link which u attached is having problem while opening. |
Odd, it opens from my net host, work machine, and home machine. Not sure what problem it might be having.
|
Quote:
|
Thanks neways jlightner
|
|
Quote:
Code:
$ typeset -l lowercase_only Code:
lowercase_only=$(echo "WiBbLe" | tr "[:upper:]" "[:lower:]") I also prefer the ksh math syntax of Code:
let a=b+c Code:
a=$(( b+c )) The biggest difference that tends to catch people out though is this one... ksh: Code:
$ echo wibble | read variable Code:
bash-3.1$ echo wibble | read variable What makes this one particularly bad is that the bash code looks like it ought to work. It's only when you understand the underlying semantics of how bash deals with pipelines that you realise why it doesn't. Because bash runs a pipeline in a sub-shell, you actually have to do it like this Code:
read variable < <(echo wibble) I prefer ksh in many ways, but I'm sure part of that is because it's what I'm used to being an old timer. |
Hi,
one reason for using ksh for scripting is, this shell is available on nearly all existing flavours of *nix. Bash is not installed by default on all *nix. |
Don't get me wrong. I've liked ksh ever since I first saw back in the early 90s. I was just saying there's a hell of a lot added to bash that doesn't exist in ksh or the posix sh.
I also agree that ksh is available on multiple platforms by default but bash would have to be specifically added. On the flip side though, most Linux distros come with bash and you have to add ksh if you want it. For most of my scripting what I learned with ksh is sufficient so I do it that way (most of my math I do by piping to bc -l which works in both ksh and bash). However, I've seen enough other examples to let me know that bash can do some fairly sophisticated things of its own that ksh doesn't. The examples show indicate different ways of doing things in bash than ksh but didn't show anything that could be done in ksh that can't be done in bash in some way. |
Quote:
Me I find bash's way of handling arrays easier and also the SIGCHILD signal (not sure if its there in KSH) is also important. |
All times are GMT -5. The time now is 03:44 AM. |