#Illumos has another #wordexp implementation (originating with Mortice-Kern, no less!) that expects a Korn (93) shell and uses its printf (and set -o), which might be tweakable to function with #OpenBSD's PD Korn shell; but like the GNU C library licence the Sun CDDL would likely be a problem.

https://code.illumos.org/plugins/gitiles/illumos-gate/+/refs/heads/master/usr/src/lib/libc/port/regex/wordexp.c

So if one is looking for "easily", where one just imports a compatibly-licenced and #KornShell-compatible existing implementation, the answer seems to be "No.".

#pdksh

usr/src/lib/libc/port/regex/wordexp.c - illumos-gate - Gitiles

#Poll: Curious about people's attitudes towards shell scripting.

Two part question:

  • Are you a DEVeloper (or working in a development-heavy role), OTHER-IT worker (such as a sysadmin, architect, anything in a non-development-heavy role), or NON-IT (accountant, doctor, whatever)
  • Do you HATE shell scripting, are you INDIFferent towards (or ignorant of) shell scripting, or do you LOVE it?
  • #Unix #UnixShell #ShellScript #ShellScripting #POSIX #PosixShell #sh #bash #zsh #csh #tcsh #ksh #pdksh #oksh #mksh

    dev - hate
    10.4%
    dev - indif
    15.6%
    dev - love
    22.9%
    other-it - hate
    2.1%
    other-it - indif
    9.4%
    other-it - love
    24%
    non-it - hate
    1%
    non-it - indif
    7.3%
    non-it - love
    7.3%
    Poll ended at .

    @jadedctrl

    DUDE! Now you can define functions in shell like void foobar() {!!!

    This is super great, because the only form that works in ksh, sh, and bash is function foo { for foo() {, but I really liked bash's function foo() {. So now I can fully restore it to C-style void foo() { and it works in #sh, #pdksh / #OpenBSD ksh / #ksh '93 / #mksh, and #bash! :D

    Ego Pontem: Shell ancestry

    A history (ahem) of command shells in Unix and Unix-like systems

    @pixelherodev
    I mean, it really depends. It's mostly an academic exercise.

    I have at&t ksh installed on my linux daily driver, I know it's 2-4x faster than bash, but all of my scripts are still in bash (even the ones that would be trivial to convert).

    20 years ago, the difference mattered a lot more to me than it does now.

    I guess I'm still just wondering why #OpenBSD still uses pdksh (and why #pdksh is still a thing). Probably just history. Already audited, don't mess with it.

    Just as I suspected, the raw loop speed on at&t #ksh is a lot faster than #pdksh, even on #OpenBSD.

    Not sure if that really matters, but I've always known "true" ksh to be a decent bit faster than bash or pdksh, for reasons unknown to me.