Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

4
  • 1
    Note that only very recent versions of ksh93 have $KSH_VERSION. That variable comes from pdksh and never made it to AT&T ksh88. Commented Apr 15, 2013 at 21:28
  • Right, which is why I have the second test for FCEDIT. Commented Apr 16, 2013 at 6:12
  • 2
    Right. Note that posh (pdksh with most non-POSIX features removed so you would probably want to call it "sh") has no FCEDIT nor KSH_VERSION but has PS3 (maybe not for long), though it's unlikely for one to have it as a login shell. Also note that the code above wouldn't reflect whether bash or zsh are in sh emulation mode, which may be a problem if you're using $PROFILE_SHELL to decide whether or not to enable this or that feature. See also Sven Mascheck's whatshell for more you may (or may not) want to check. Commented Apr 16, 2013 at 6:25
  • 1
    This is the cleanest approach if readability matters. Commented Jan 21, 2020 at 13:07