Hacker News new | ask | show | jobs
by webreac 3112 days ago
At work, in the scope of a migration from RHEL 6 to rhEL 7, I have spend a lot of time migrating scripts from ksh (pdksh) to bash in order to remove this dependency. I have not seen any advantage of ksh over bash. There are many differences (ksh is less strict), but IMO there is no point in keeping 2 mostly similar but incompatible shells when less and less people are using shell. I think ksh should die. Maybe I am missing something ?
2 comments

There are TONS of advantages to ksh93 over bash.

-Floating point math, not just integer

-Coprocess syntax that is correct and compliant

-Genuine Korn retains variables in control structures

-Lots more, detailed in the Korn & Bolsky ksh93 book

The language specification for ksh93 is large and powerful, and bash doesn't approach it.

The biggest benefit of real ksh, to me, is that variables don't disappear in weird cases, such as:

    cat file |\
    while read stuff
       do other stuff; set variable
    done
In ksh93, variables set within the while loop stay around outside of it. Whereas bash will run the while loop in a forked sub process.
That just sounds like (practically speaking, if not totally accurately) local scoping.