What is the difference between korn shell and bash shell




















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.

Bourne-compatible shells. Since they share common features and overlap each other, there are interchangeable to use. This causes some confusion to novice users. Bash is a newer shell compared to the KSH shell.

Bash, as the new shell, has more resources and more computer users as followers. Bash is a free and public utility shell which is often used in open-source communities and applications. Bash also acts as an extension of the Korn shell since it incorporates the features of the latter shell and some added features.

It all depends on your target platform: Bash is the defacto shell standard in Linux, if you go with ksh, you will have to make sure it is installed. 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 older versions of bash you have to keep the number of conditionals in the if statement to two or less. That would look like this:. The workaround is to use nested if statements like this:. In this respect, Korn shell has an advantage over bash since it is more friendly to multiple conditionals in an if statement. If you are used to the interactive!! The syntax for arrays are different. Korn has the feel of the old Unix hard-wired, serial terminal days.

Too much work. It took about 35 scripts to do so. It logged incoming and outgoing files to a database. Figured out who needed notifications and emailed the proper recipients for several separate facilities and literally hundreds of vendors. It served for over 10 years, slowly being modded as necessary.

It was recently retired and replaced by a larger system with a team of programmers. Name required. Email required. Practically speaking, ksh93 binaries on commercial Unix systems tend to be very early versions of ksh93 ; you should download the source and build your own executable version if you wish to use ksh93 for production work. Skip to main content. Unix in a Nutshell, 4th Edition by Arnold Robbins.



0コメント

  • 1000 / 1000