is /bin/sh more like a Korn-Shell or more like a Bourne-shell or still something else ?
And which one is best ?
And which one is best ?
I think it's better to say that "Bourne-shell and Korn-shell are more like /bin/sh".is /bin/sh more like a Korn-Shell or more like a Bourne-shell or still something else ?
And which one is best ?
is /bin/sh more like a Korn-Shell or more like a Bourne-shell or still something else ?
And which one is best ?
I believe the original shell for BSD/Unix.
My opinion:Currently my root shell is zsh and it executes all the sh in rc.d scripts just fine.
My recovery shell toor is oksh. As it has no dynamic dependencies.
Still I wonder is it worth to learn ksh ?
csh and sh (bourne). almost all of the current shells are derivatives/extensions of these.
Use bashisms for substitutions and try to run it with raw sh? Gonna break. Same thing for zsh/ksh/whatever-sh.
Still I wonder is it worth to learn ksh ?
Everything is worth trying. (Well, almost everything.)
Yes.is /bin/sh more like a Korn-Shell or more like a Bourne-shell or still something else ?
And which one is best ?
I think readability of shell script code is important.
/bin/sh
is the Almquist Shell -- an unencumbered Posix compliant version of the System V Bourne Shell.But nushell looks interesting to filter,sort data in tables.
The only people I come across that regularly write ksh scripts is Oracle DBAs - I know the odd old (pre-Oracle) Solaris admin that also uses it for both scripting and interactive use.Still I wonder is it worth to learn ksh ?
On AIX, all system scripting is done in ksh. It's generally the only shell that AIX people know.The only people I come across that regularly write ksh scripts is Oracle DBAs
Agreed, but shell is a pretty awful programming language. I have always been of the view that as soon as a shell script got complicated it was time to move to perl(1), but that just makes me old fashioned these days.generally like my scripts to be portable.
perl(1) is much bashed upon (no pun intended!) when you google around what could be a proper scripting language. In fact, from my own experience, I find Perl pretty awful. For example: How do you prove that your regex doesn't yield a false positive? Is there support for proper way of testing your code, etc.? In general, I frown upon the whole “bash on stereoids”-pradigm that lies at the heart of Perl. Let alone the horrible ”there are a thousand ways of doing things”-syntax.On AIX, all system scripting is done in ksh. It's generally the only shell that AIX people know.
Agreed, but shell is a pretty awful programming language. I have always been of the view that as soon as a shell script got complicated it was time to move to perl(1), but that just makes me old fashioned these days.
Why is Perl the superior scripting languange?
perl
is Perl 5, not "GNU Perl", not "BSD Perl", not a symlink to Python.I find "lua" not bad as language. It's also used by the freebsd-boot-loader.
Bash was released in 1989. It is not Posix compliant.I frown upon the whole “bash on stereoids”-pradigm that lies at the heart of Perl.
It's certainly not perfect, but I find bash "pretty awful" to a much greater degree (for scripting). Perl is:I find Perl pretty awful... What are its benefits?
Perl dates back to 1987. So perl was first. I remember unpacking it from comp.sources.unix.
Perl has been universally available and portable from its inception.
In fact, perl's ./Configure script paved the way for vast improvements in free software portability.
It's certainly not perfect, but I find bash "pretty awful" to a much greater degree (for scripting). Perl is:
- designed from scratch as a scripting language;
- mature (with a vast library);
- well documented;
- portable;
- powerful;
- has integrated protections against hacking -- vital for CGI scripts -- with taint method; and
- really fast at just about everything, but orders of magnitude faster than any shell on string handling.
Speed can be vital if you are processing large text files in real time.
Also, I know it's historical, but perl's pattern matching was just stunning (not to mention trail blazing).
Like C and C++, perl requires professional discipline to produce "good" code. i.e. there's a vast amount of rope, and plenty enough to hang yourself -- but there's usually little glory without power.