53
submitted 11 months ago by Manbart@beehaw.org to c/unixporn@lemmy.ml
you are viewing a single comment's thread
view the rest of the comments
[-] Contort3860@links.hackliberty.org 6 points 11 months ago

Nice. Just curious about your choice of shell. Why ksh instead of the usual bash, zsh, or fish?

[-] Manbart@beehaw.org 8 points 11 months ago* (last edited 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

[-] Contort3860@links.hackliberty.org 3 points 11 months ago* (last edited 11 months ago)

Nice to know. Thanks for the detailed reply.

[-] haypp@lemmy.ml 1 points 11 months ago
[-] Contort3860@links.hackliberty.org 1 points 11 months ago

They're all slightly different.

this post was submitted on 02 Dec 2023
53 points (96.5% liked)

Unixporn

15393 readers
1 users here now

Unixporn

Submit screenshots of all your *NIX desktops, themes, and nifty configurations, or submit anything else that will make themers happy. Maybe a server running on an Amiga, or a Thinkpad signed by Bjarne Stroustrup? Show the world how pretty your computer can be!

Rules

  1. Post On-Topic
  2. No Defaults
  3. Busy Screenshots
  4. Use High-Quality Images
  5. Include a Details Comment
  6. No NSFW
  7. No Racism or use of racist terms

founded 5 years ago
MODERATORS