What is the difference between ksh and bash




















Here we also discuss the Korn Shell vs Bash key differences with infographics and comparison table. You may also have a look at the following articles to learn more —. Submit Next Question. By signing up, you agree to our Terms of Use and Privacy Policy. Forgot Password? This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy.

By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy. Course Price View Course. Free Software Development Course. Login details for this Free course will be emailed to you. Email ID. Contact No. Korn shell provides much better performance than Bash shell when dealing with the execution of scripts and commands.

On any running system Bourne shell got to be available plain sh or bsh , so you could write a wrapper around your script and check whether BASH or KSH are available. So the read works, but arg1 arg2 arg3 are not visible in the scope of the main shell. The other major difference I know is that bash disconnects stdin from asynchronous children, but ksh lets them all read the same pipe, which I use for load sharing algorithms. Jalal: Nice comparison page.

Paul: Thanks for the distinction about the handling of pipelines. During the nineties, I was using a commercial version of Ksh, found a bug in it, so I formally sent in a defect report, and oscillated between ksh and bash, depending on my needs.

In the timeframe, ksh still had a slight edge over ksh in functionality, but or thereabouts seemed to be a meeting point. By then they were virtually but not precisely equivalent. However, pdksh, which, to me, was way behind most of the other shells, has long since caught up in the majority of areas of importance and interest.

I would suggest that any of these three: ksh, its free equivalent, pdksh, and bash all offer basic POSIX-style sh script capabilities, with the important additions of command history and editing that both ksh and bash have long offered over the classic sh. As far as csh goes, I think it is too static for any serious consideration, and full of problems to use as a scripting language.

Tcsh is much better than csh, but considering that it has many of the same limitations as csh, I do not use it very often any more.

We can, however, thank the tcsh project for many features that have made their way into Bash — and for that matter, zsh. Finally, zsh. Bash does. In that case, ksh works fine. I work mainly on AIX, so I use ksh most of the time. If your going to use the shell for floating point numbers you should just switch to awk. It does a good job up to 32bits for floating point.

I never use the shell to do complex math. Most of the time is simple stuff, add counters, divide by or 8 or such, the kind of stuff you need to build reports, arithmetical averages and not much more. I think bash makes a user friendly login-shell but is overestimated as the all in one shell for all purposes.

I have 3 reasons to use the ksh besides bash. Bash has some handy and nice extra features compared to ksh, but bash is getting more bloated from version to version, while ksh remains lean and fast. Well, convenience is one of the most important things for system administrators. Hi, ksh needs less memory than bash You can download source code of bash and install it under?

I only use the arrow keys in bash, all ksh is done with vi keys. There are two entirely different things here. Assuming you actually have both ksh and bash installed:. As long as you shebang each script, you can use both. Most if not all Linux distributions have bash installed and ksh optional. Personally I always use ksh, I love the vi completion and I pretty much use Solaris for everything.

I don't have experience with ksh, but I have used both bash and zsh. I prefer zsh over bash because of its support for very powerful file globbing, variable expansion modifiers, and faster tab completion. For scripts, I always use ksh because it smooths over gotchas. But I find bash more comfortable for interactive use. For me the emacs key bindings and tab completion are the main benefits. But that's mostly force of habit, not any technical issue with ksh. Z shell has a good combination of ksh's unique features with the nice things that bash provides, plus a lot more stuff on top of that.

Actually, the standard shell is Bourne shell sh. My answer would be 'pick one and learn how to use it'. They're both decent shells; bash probably has more bells and whistles, but they both have the basic features you'll want. If you're using Linux all the time, just stick with it. If you're programming, trying to stick to plain 'sh' for portability is good practice, but then with bash available so widely these days that bit of advice is probably a bit old-fashioned. Learn how to use completion and your shell history; read the manpage occasionally and try to learn a few new things.

Available in most UNIX system, ksh is standard-comliant, clearly designed, well-rounded. I think books,helps in ksh is enough and clear, especially the O'Reilly book. Bash is a mass. I keep it as root login shell for Linux at home only. I run scripts in zsh, but I'll test most of my scripts, functions in AIX ksh though. If you're planning to distribute the scripts, use Bash.

Bash is the standard for Linux. My experience is that it is easier to find help for bash than for ksh or csh. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams?

Collectives on Stack Overflow. Learn more. Bash or KornShell ksh? Asked 13 years, 1 month ago. Active 2 years, 8 months ago. Viewed k times. Improve this question. Add a comment. Active Oldest Votes. There are certain advantages one has over the other, but the differences are tiny: BASH is much easier to set a prompt that displays the current directory. To do the same in Kornshell is hackish. Kornshell has associative arrays and BASH doesn't. Now, the last time I used Associative arrays was Let me think Kornshell handles loop syntax a bit better.

You can usually set a value in a Kornshell loop and have it available after the loop. Bash handles getting exit codes from pipes in a cleaner way. Kornshell has the print command which is way better than the echo command. Bash has tab completions. In older versions Kornshell has the r history command that allows me to quickly rerun older commands.

Kornshell has the syntax cd old new which replaces old with new in your directory and CDs over there. In BASH, you'd have to cd.. Improve this answer. Community Bot 1 1 1 silver badge.



0コメント

  • 1000 / 1000