• Manbart@beehaw.orgOP
    link
    fedilink
    arrow-up
    8
    ·
    edit-2
    11 months ago

    Aside form all the stuff you find in bash, it has some additional unique features mostly related to shell programming. A few example include

    • floating point arithmetic and math functions like sin, cos, exp etc
    • “compound” variables (kinda like an object in javascript)
    • An extended version of getopts which supports both long and short options, and it implicitly creates some additional options for you i.e. a usage page available at --help and a longer manpage style output available at --man
    • In addition to the usual shell builtins, it has a ton of optional ones you can enable at build time, which ranges from basic stuff like chown and chgrp (faster than invoking a new process) to an integrated tcp/udp server with an event loop (i.e. “mkservice” and “eloop” commands)
    • Command line and history editing with vi/emacs commands
    • coprocesses: you can start programs/subshells in the background but still communicate with the std input/output of them while the main script runs either by using the -p flag to read/print or by assigning file descriptors to them (so you support more than one background process this way)

    TBH, I don’t even use some of these features, but it’s still a very cool shell, and probably underrated. Not to mention I like being contrarian at times.

    Note; AFAIU these advanced features don’t apply to ksh’s clones like mksh or openbsd’s ksh, they are unique to the original “ksh93”.

    On the downside, it’s command completion is pretty basic compared to bash. It completes paths and filenames, but you can’t extend it to complete command line arguments to commands or anything