Tuesday, October 30, 2018

Why&how do "sh" and "ksh" differ in behavior e.g. PS1 presentation, while their binaries are equal?

Hi misc@,

I noticed that sh and ksh have different behaviors from doing
"export PS1='\[\033[01;35m\]COLOR\$ '", here "sh" shows
"\[\033[01;35m\]COLOR#" in gray, while "ksh" shows "COLOR#" in purple.

sh and ksh's binaries are equivalent.

I do see that sh's and ksh's man pages differ, e.g.
http://man.openbsd.org/ksh#PS1 and http://man.openbsd.org/sh#PS1
differ.

Until now however I used to think that while they have different
documentation (different interfaces), they would actually behave the
same.

On a quick sourcecode check I didn't see any code paths e.g.
"if (argv[0] matches "ksh") { something } else { something else }"
however I presume I missed something.

What's going on, what's the point?

Joseph

No comments:

Post a Comment