How can shell scripts be shared by different shells?

Andy Clews andy at syma.sussex.ac.uk
Fri Apr 5 23:36:04 AEST 1991


A problem has arisen at our site, whereby most of our users use Csh but a
few others use Sh derivatives (i.e.  Ksh and Bash).  Some users are
expressing an interest in changing to Ksh from Csh, a move which we tend to
encourage because Ksh is generally considered better than Csh. 

Some users, who are part of a course, and who are Csh users, have a "source"
command in their .login files which takes commands from a central C-shell
file, which does things like setting special paths and environment variables
and so on.

The problem is: supposing any of these users want to switch to Korn shell?
If they make an equivalent .profile file, and put ". shellfile" instead of
"source shellfile" in it, then Ksh naturally won't understand the Csh
commands in the central "shellfile".

Does anyone know of any clever kludges that can be made to this central
shellfile, which could allow Ksh or Csh to be able to source it? I thought
of putting a test at the top, but of course tests are different in Csh
and Ksh.....

I hope I haven't missed something in TFM....
-- 
Andy Clews, Computing Service, Univ. of Sussex, Brighton BN1 9QN, England
JANET: andy at uk.ac.sussex.syma        BITNET: andy%syma.sussex.ac.uk at uk.ac



More information about the Comp.unix.questions mailing list