[TUHS] ksh88 source code?

jason-tuhs at shalott.net jason-tuhs at shalott.net
Wed Dec 22 16:23:17 AEST 2021


>> Bash is GPLd. Ksh isn't. :)

> What is the effective difference between GPLed software; Bash, vs 
> non-GPLed software; Ksh?
>
> Why, as a lay user, would I care?

As an end user, you would not care.

As a vendor or distributor, you would care.  Anyone doing an OS or other 
software distribution (think the BSDs, of course; but also think Apple or 
Microsoft) needs to care.  Anyone selling a hardware device with embedded 
software (think switches/routers; think IOT devices; think consumer 
devices like DVRs; etc) needs to care.  GPL (or similar "virally" 
licensed) software carries legal implications for anyone selling or 
distributing products that contain such software; and this can be a 
motivation to use software with less-restrictive license terms.


> I get the historical interest, but in today's world, is there any 
> advantage to ksh over bash?

I'm aware of a few random features that are in ksh93 but not other shells 
(random, trivial, example that I saw just today*: "printf %(FORMAT)T"). 
That said, my first impulse would have been to say no, there aren't any 
meaningful (technical) advantages to ksh over bash -- except that it seems 
there's still some amount of active development going on in ksh:

https://github.com/att/ast/issues/1466

So I guess, for some people at least, there are indeed reasons to prefer 
it, including (according to users in those github issues) performance.


On the licensing front, the GPL is an issue for bash; but zsh is available 
as a more modern, fully-featured shell that avoids any GPL issues.  This 
is why Apple switched the default shell in OSX from bash to zsh: they 
wanted to avoid the GPLv3.  Previously, they had been shipping the last 
GPLv2 version of bash, which was from 2006.  According to this blog, 
they've been avoiding any GPLv3 code and actively working to remove even 
GPLv2 code in OSX for quite a while:

http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/


  -Jason


* bash seems to recognize %(FORMAT)T, but only takes epoch seconds as an 
argument.  ksh93 takes anything vaguely date-like.  zsh and pdksh don't 
recognize it at all.

 	for S in ksh93 pdksh bash zsh ; do echo "===> ${S} <===" ; eval "${S} -c 'printf \"%(%F)T\n\" \"last thursday\"'" ; echo "" ; done

 	===> ksh93 <===
 	2021-12-16

 	===> pdksh <===
 	printf: illegal format character (

 	===> bash <===
 	bash: line 1: printf: last thursday: invalid number
 	1969-12-31

 	===> zsh <===
 	zsh:printf:1: %(: invalid directive



More information about the TUHS mailing list