michael@stb.uucp (Michael Gersten) (12/09/89)
In article <12086@cbnews.ATT.COM> res@cbnews.ATT.COM (Robert E. Stampfli,55216,cb,1C315,6148604268) writes: >In article <1717@mtunb.ATT.COM> jcm@mtunb.UUCP (John McMillan) writes: >> >>1) Replacing SH with KSH is a serious breach of sanity. >> KSH is ALMOST a superset of SH -- but the differences are VERY >> REAL. It can waste hours or days for support people when folks >> play this game. > >With all due respect for John McMillan and his useful postings, I must admit >to having made ksh my standard /bin/sh years ago and, so far as I can tell, >... >If anyone actually has an example of ksh breaking a command, etc, I would >really like to hear about it. Please send me the particulars so I can try >it on my system. Ok. Here's a VERY real problem with ksh vs sh. Note that I have cross posted to news.software.b. (Oh yea--system is 3b1, running a moderately old ksh. Not too old, but not too recent either). I recently installed C news on my system. Played with inews (a nice little shell script), but could not get non-local groups to post correctly. I traced it to a line that calls sed to turn a '.' into a '\.' for passing to egrep; it was instead passing '\\.'. Turns out the line in the script had 4 backslashes; I trimmed it to 2. Worked fine. Then I ported rn. Worked fine. Pnews ran beautifully. Then I tried to followup an article. It didn't work. It was now substituting a '&' for the '.'; this was from the next character in the sed command that was being substituted (its a pretty hairy line). Some trials and tribulations later, I discovered that when ksh finds a shell script, it executes it itself; when system() or execvp() is called, it uses /bin/sh for shell scripts. They have slightly different rules for handling the '\\' sequence in scripts. So far ONLY C news inews breaks on this. Well, not quite. Configure (from rn) will core-dump its ksh. Yea, not just an error, but the shell dumps core. Never did trace that one down. Finally, there is the biggest difference I've found so far. This one bit me *HARD* when I started installing shell scripts that paid attention to EDITOR and VISUAL, neither of which was set anywhere in my system (/etc/profile, /etc/rc, ~/.profile, etc). EDITOR would be set to /bin/ed. Worse, this was NOT in the environment (printenv did NOT show it), but it WAS passed to shell scripts. So shell scripts would get a different environment than non-scripts. This is the biggest difference I've found so far. Michael