AT&T's Korn Shell Source Code Released
Henk Langeveld writes, "This announcement can be found at kornshell.com:
March 1, 2000: I am happy to annouce the the 'i' point release
of ksh93 is now available for download. For the first time, source
is available as well as binaries for several architectures. If
you build binaries for new architectures, and send them to us, we can add
them to the download site. The download
page has been completely revised in a manner that hopefully will be
easier to use. ksh93 is part of the ast-open package. tksh
(ksh with tk support) is also part of this package. -- David Korn
As a long-term fan I'm glad to see the korn shell now being released under a new license. The license is quite non-standard, and does include some restrictions (changes can only be distributed as patches), but as far as I can see it does allow anyone to bundle binaries with their products. The distribution format is quite non-standard. The research group at AT&T has their own packaging system, built around nmake. "
As a long-term fan I'm glad to see the korn shell now being released under a new license. The license is quite non-standard, and does include some restrictions (changes can only be distributed as patches), but as far as I can see it does allow anyone to bundle binaries with their products. The distribution format is quite non-standard. The research group at AT&T has their own packaging system, built around nmake. "
Type "man zshexpn" if you don't believe me.
Is there any other shell where you can do things like this:
ls -l **/*(.m-7)For you non-zshers, that glob means "expand recursively, matching plain files only, that have been modified within 7 days". And of course you can hit TAB to have the glob expand in place for your viewing pleasure.
and consequently I've never really learned Bash.
Nice to hear it's source code is available.
BTW It's been a free non-commercial download for years already.....
BTW, there are some really cool .tcshrc files on dotfiles.com. Check out the [gjvc] .tcshrc-* tarball!
New XFMail home page
I spend a lot of time in the shell, writing what amounts to very small scripts (piping, substitution, etc) that never make it past the interactive command line. And sometimes, after writing the same thing many times, I make a script of it.
And it's so very easy to write a script, because I've been writing the same thing on the command line. The transition is nearly seemless. A shell is a direct connection to Un*x commands, with only a thin veneer of control structures and variables.
I'm sure there are interactive versions/frontends to perl, but I haven't personally seen them. bash is always pleasantly interactive, always present, nearly standard, has a low syntactic burden for its intended realm, and allows me to program interactively. (why would anyone want a non-interactive interpreted language? At least C has an excuse)
He seemed to think that the original still had some features not available in pdksh or elsewhere.
The single feature which has repeatedly stung people I know, moving from ksh on AIX to bash or pdksh on Linux, is this:
echo 1 2 3 | read x y z
echo $z $y $x
In ksh, the result is "3 2 1".
In any other shell I've tried, because the "read" occurs in a subprocess with its own environment, $x $y and $z are empty.
If I'm not busy at some point this week, I might have a look at the ksh source to see whether it treats read differently to other shell builtins...
--
More source code is good no question, but Yet Another License sigh. I know (and agree) "Those who write/pay for the code get to choose the license." still how much does a custom licence buy you vs the cost of keeping all the licences rules in staight?
-Peace
Dave
Free as in "the Truth shall set you..."
malicious newbie
Wouldn't someone who is going to hack the source code to a shell be a bit more than a 'newbie' ?
We're not talking script-kiddie activity here...
Everywhere I've seen that's not an ancient all-commercial SVR4 UNIX or somesuch, tcsh has been installed. In most cases it is the default shell (though bash is making inroads). By comparison, zsh is usually not installed and seldom one of the standard shells (which is a pity, as it's much more capable than the others).
Now that ksh is released, is there any reason to choose it over zsh? Does it have any compelling features that may differentiate it from the open-source products that arose in its absence, or is it just a curious historical document?
ksh actually already has much of what you would consider to be readline support. See my other comment for info on how to enable it.
I assume you're referring to the lack of the items in your subject line; I have, in my .kshrc, pushd/popd shell functions written by Fletcher Mattox (at the University of Texas at Austin). I don't personally miss ! history or arrow keys, but others might.
...as do I, as there's no guarantee that another machine will have any shell other than /bin/sh.
...but I personally dislike I-search (interactive search or incremental search, whatever the "I" stands for), which is why I personally prefer ksh to bash (and to pdksh). Others may like I-search, in which case they might prefer bash or pdksh.
I.e., it's just like |& in the C shell? (|& isn't a zsh invention.)
Given that, in the Bourne shell (and compatible shells such as ksh and bash), you send both the standard output and standard error somewhere by doing
or
it's not necessarily surprising that bash doesn't use (or need) |& and that ksh uses it for something else.
Does it have all four forms of history, including the fourth, non-I-search (of the sort ksh has, i.e. type control-R - yes, I want EMACS-style commands - fill in the string for which to search, and then hit the Enter key)?
Thanks
Bruce
Bruce Perens.
There is a perl shell, I haven't tried it but it looks interesting. Look here:
http://www.focusresearch.com/gregor/psh/
Description reads as follows:
The Perl Shell is a shell that combines the interactive nature of a Unix shell with the power of Perl. The goal is to eventually have a full featured shell that behaves as expected for
normal shell activity. But, the Perl Shell will use Perl syntax and functionality for for control-flow statements and other things.
-- I speak only for myself.
I think this is rather cool of them to do. When I first started using ksh for real, I was already ingrained in bash. I spent countless days swearing at "that infernal ksh piece of crap..." Once I learned how bash stuff could be done in ksh, the swearing was over.
The things I miss that are in bash are:
- no !$ substitute! ($_ seems to be the ksh equiv)
- no arrow history! (i use vi mode...)
- no tab completion! (pdksh's vi-tabcomplete mode is heaven, tho)
There're prolly a few more, but those are the most nagging. Doesn't stop me from being productive with "plain" ksh...--
--
Me spell chucker work grate. Need grandma chicken.
If you build
binaries for new architectures, and send them to us, we can add them to the download site.
I see a problem with this. What if a malicious newbie put some equally nasty routines in their source code and sent them the binaries? Trust has worked fine for a good amount of time for us free software people, but we have to remember that due our popularity a lot of unwanted people are also among us.
--
That's what I detest most about ksh for interactive use. I tolerate ksh, but I sure don't like it. Only thing worse is csh :-)
/bin/sh now. I have been bitten too often by incompatibilities.
I have also had shell scripts allegedly written for ksh (#!/bin/ksh) which worked on most machines but not all (we use Solaris, SunOS, AIX 3/4, HP-UX, etc etc etc).
I write my shell scripts for
--
Infuriate left and right
Zsh has fpath and supports most (all?) ksh syntax. Bunch of cool interactive features too.
AT&T has released free source and binaries of KornShell for non-commerical and educational use.
Maybe I didn't look at the right web page. The license displayed on the download page is confusing. I didn't see a restriction to non-commercial and educational use in that license. Can anyone clarify the situation?
Mea navis aericumbens anguillis abundat
A few years ago, when awk, shell, and Motif, were the only games in town, that would have been great news. I used to write a lot of scripts in awk and shell. But these days, almost every machine has Perl, and you can get Tcl/Tk and Perl/Tk easily. Those tools are hardly without flaws, but for day-to-day scripting, I prefer them greatly to anything shell based.
Perl is great when you have megagobs of memory and storage to throw around. It won't, however, fit onto a floppy disk; the perl5 package (just perl itself, we're not even talking tcl/tk here) is 13mb. That's a whole box of floppy disks.
No, dude, the shell is NOT dead. There is NO substitute for #!/bin/sh when space gets tight and the rubber really meets the road. Same reason you don't even see vi on a rescue disk anymore, it's pico. Unix the old fashioned way. Tight as a Scot's purse and sharper than his tongue.
Glenn Stone
Clan Gordon
And Bruce is also my hero. No shit! I was just installing Slink on a box today and it's really cool to see a familiar name pop up that I see everyday (almost) on /.
The Toys R Us has the 'R' backwards also. Coincidence? I don't think so. ;-)
One of the most missing features in pdksh is the FPATH variable. All my tested/debugged functions go into files that the FPATH points to. Then any script I write can use any of those functions by just calling them as if they were included in the script. Saves a lot of time having when writting scripts.
Dyslexics Untie!
who would expect Bruce Perens to misspell his last name? mod this to -1 so it becomes the default.
--
+&x
I hate to reply to my own post, but I managed to dig up the comp.os.unix.shell FAQ posting on shell comparisons: here.
Definetely worth a look for those shopping for a shell...
engineers never lie; we just approximate the truth.
I just checked and can't believe that there hasn't been one, but I couldn't locate a Slashdot Poll for "Favorite Shell". If this hasn't been a poll item before, it might be interesting to do one for this.
Kris Magnusson
Open Source Architect
Novell, Inc.
"I thought I could organize freedom. How Scandinavian of me."
Where have you been for the last decade? Perl killed shell scripting for non-trivial automation years ago.
tcsh is a derivative of csh, the most ill-conceived shell available.
nmake is not Microsoft nmake, it is the AT&T Bell Labs next-generation make that is way better than standard UNIX make: parallel builds, include file scanning, coshell (instead of fork/exec for every shell command), distributed build support, compiled makefiles, state tracking from one build to the next, etc., etc., etc. When originally developed, it helped cut build times for the AT&T 5ESS switch from 3 days down to 1. http://www.bell-labs.com/project/nmake/
ksh is actually quite servicable in the absense of a better one, as long as you apply the right magic to your .shrc or whatnot. To get some decent command line editting do a 'set -o emacs', to get the arrow keys etc to work
alias __A=`/bin/echo "\020"` # Up
alias __B=`/bin/echo "\016"` # Down
alias __C=`/bin/echo "\006"` # Right
alias __D=`/bin/echo "\002"` # Left
alias __H=`/bin/echo "\001"` # Home
alias __p=`/bin/echo "\004"` # Delete
alias __q=`/bin/echo "\005"` # End
alias __z=`/bin/echo "\017"` # Clear
(The previous works on Solaris, it might need some tweaking for different forms of echo) Unfortunately, I don't know of an easy way to get TAB to do filename completion (the default is ESC ESC) Would I rather use ksh than bash? No. But, there are a lot of times when getting ksh to work nicely is easier than getting bash onto the machine in question.
Not that I don't like bash, but ksh is what I use at work and what I used for years prior to encountering using Linux for the first time. But perhaps my habits have become restricted to only the functions that the two hold in common. ;)
I've never really looked closely at the differences between bash and ksh but the question that occurs to me is this: has bash overtaken ksh in functionality to the point that this release is now too late to matter?
Geeky modern art T-shirts
This reminds me of the article posted a while ago on the original Unix source code being available. Something like "Open source in history"? Ah , here it is. Anyway, kind of sad that it took this long for one of the best shells to be released. I'm not blaming David Korn, it's a great shell and I'm sure he did what he thought was most responsible for AT&T to do with it. Heck, I'm completely willing to believe that it took this long to convince his bosses that it would be a good idea from a standpoint of actual improvement to the code. I don't see anything on the web site as to why they decided to release , although "free for non-commercial and educational use" is not exactly what I'd call "free source"...
Walt
Walt
I read all the comments related to AT&T's Korn Shell Source Code Released
y not)
/dev/tcp/hostname/portno with redirections.
posting and decided to provide some additional information that
should clear up so many misconceptions. I will also try to get a FAQ
on the kornshell.com site to clarify many other points as well.
First of all, I would like to thank they authors of bash, pdksh,
and zsh for their valuable contributions. I have tried to
provide information on changes to ksh so that these shells
could add these features in a compatabile way.
I will respond to some of the comments here:
1. Too little too late. This may or may not be true, but it
is irrelevant. At this point, it's too early to make such
a statement -- the user community will decide. I would have
prefered to make this OpenSource from the beginning but I did
not have this option. It has taken a lot of effort to get
this source released at all. Note that ksh93 is only a
part of this AT&T open source distribution and that there are
tools that have no other UNIX/LINUX equivalent.
2. bash is much better than ksh.
These comments have no information that would make them
meaningful without specific examples. What version of ksh
and what version of bash? I am interested in hearing which
features of bash are missing from ksh93 (see point #5).
3. zsh is better than ksh.
Although zsh has an impressive set of features,
it is not POSIX compatible making it difficult to write
portable scripts. I am interested in hearing from zsh
users what *language features* are missing in ksh93
(I am aware of most of the interactive enhancements).
4. tcsh is better than ksh.
Irrelevant. tcsh is based on csh, which is generally agreed
not to be a good scriping language. So why compare it?
See "csh programming considered harmful" by Tom Christiansen
(http://www.faqs.org/faqs/unix-faq/shell/csh-wh
5. There are some features in ksh93i that some users seem to be
unaware of. Several of these are not in bash, zsh, or pdksh.
a. File and command name completion (using tab in viraw mode).
b. Key binding (arrow keys work on most systems by default).
c. Process substitution, e.g. command1 ( command2 )
d. Ability to connect to tcp or udp connections using
e. Complete ANSI-C floating point arithmetic, including
math functions.
f. Complete ANSI-C printf formatting with several extensions
including date/time foratting using %T.
g. ANSI-C string input using $'...'. (I believe zsh has this).
h. Associative arrays.
i. Extended regular expression matching/replacement including
backreferences for shell variables.
j. Runtime loading of extensions including builtins.
There is an API for referencing ksh93 internals.
k. Active variables. The ability to associate processing
functions with shell variables (similar to traces in tcl).
l. Compound objects, useful for implementing data structures.
m. Reference variables for passing variables by name.
n. The shell is written as a library that can be reused
in other commands. For example, dtksh which combines
ksh93 with X11 and Motif, and tksh which combines
ksh93 with tcl/tk.
5. Confusion about the licensing terms.
The kornshell.com home page hasn't been updated yet so it still
contains outdated references to commercial and educational
uses. There is no such distinction. The license does
allow for commercial distribution of binaries and/or source.
We do not have OSF certification as of yet, but I do think
that the license satisfies all of the OpenSource principles.
The license does not have the GNU GPL restrictions.
6. nmake is not Microsoft nmake.
It certainly is not. It is simply the best make program
that I have every seen. The Makefiles are consice and
protable. No makefile or dependency generators are needed.
It can generate both UNIX makefiles and Microsoft nmake
files for systems that do not have AT&T nmake.
What's really funny is that I've been to USENIX conferences with Dave and he's worn "Korn" T-shirts. I about died the first time I saw him doing this.
Actually, even more funny was when I was at the USENIX Windows NT symposium a few years ago. The Microsofties were up on stage talking about their Unix toolkit for Windows NT. This includes several common Unix commands (ls, cp, ps, etc.) along with a version of ksh. Dave stood up and went to the microphone and mentioned a few areas of incompatibility with the version of ksh used in the Unix toolkit for Windows NT. The Microsofties, not realizing who they were talking to, kept going back and forth with him, insisting that their version of ksh actually did comply with the AT&T ksh, and sort of implying that Dave (who they still didn't recognize) didn't know what he was talking about. Nearly everybody in the audience was laughing out loud, and eventually somebody let the Microsofties in on who exactly they were talking to.
But for scripting, I always use ksh (on Solaris). Why? The ksh syntax is a superset of the original Bourne Shell, and therefore pretty much a superset of the Bourne Again Shell.
bash primarily adds readline support which makes it super-easy to use interactively. readline doesn't do much for non-interactive scripts.
In the Korn shell, the typeset comand provides a number of extra features for things such as presenting non-decimal numbers, and converting from upper case text to lower case and vice versa.
Another way cool feature of ksh is `|&` which is a way of getting a pipe to a background process. I guess they call it co-processes, but it really make a client/server process. I guess you can also call it a bi-directional pipe. You can then use `read` and `print` to send and receive stuff from the "server" started with `|&`. For example, if I need to do floating point math, I can start `bc` in the background with `|&`.
I think what we need is a ksh with readline support added. Bourne Again Korn Shell! (Maybe spell "Bourne" as "Born)
I discussed the ksh source release with David Korn a while back, including the point that it was probably too late. He seemed to think that the original still had some features not available in pdksh or elsewhere.
Thanks
Bruce
Bruce Perens.
- a "you must monitor our web site" clause
- a "you are responsible for ensuring that people you distribute the software to comply with this license" clause
- a "you must contact us if you distribute patches" clause
- an unilateral-termination clause
- a "you must adhere to U.S. law" clause
The 'ensure that others comply' and the 'Termination clause' seem very non-free, the others are only very annoying (especialy if you don't have easy internet access and live outside the US).AT&T shares fell in early trading after the popular band "Korn" announced a lawsuit for trademark infringement. "It's obvious they're using our name. Who would have thought of spelling corn with a "K" except us?" commented a lawyer for the band. AT&T declined to comment on the suit.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?