is ksh still relevant today? at my first job i worked on IBM AIX systems that only supported ksh, and all the old timers were convinced that bash was inferior
One reason is that its `getopts` makes it very easy to provide full short and long option processing with help messages; script boilerplate is something like
usage=$'
[-1]
[a:a-long-option?Help text]:[number]
[b:bool-long-option?Helpful text]
'
while getopts "$usage" c
do
typeset opt_$c="${OPTARG:-1}"
done
Another is that the final command of a pipeline runs in the shell environment, so that you can do things like bunch |
of |
commands |
while read some stuff
do
RESULTS[$some]="$stuff"
done
and then use the $RESULTS. That is fairly painful in bash; basically you have to wrap the entire rest of the script in { … }.Fortunately, zsh can operate in ksh emulation mode [1] so I was able to leverage zsh while I was there to some extent.
The system I worked on there is still being actively used and developed today and still relies on a fragile set of ksh scripts to build and run in certain environments.
[1] https://zsh.sourceforge.io/Doc/Release/Invocation.html#Compa...
So yes, somebody still must've been using it.