Linux Lover
2003-08-22 15:14:59 UTC
Greetings,
I have this problem in which I "inherited" a huge system implemented
using shell scripts. This is already a maintenance nightmare, but what
makes it especially painful is that about half of the scripts are
written in ksh and half in csh. To make matters even worse, many of
the csh scripts are simply duplication of the ksh ones, so whenever a
change needs to be done, it has to be implemented in BOTH the ksh and
the csh version...
I would love to get rid of the csh scripts and convert to an all ksh
shop. However, in my work environment I cannot do it all at once - it
must be done gradually.
I was therefore thinking of starting by just eliminating the
duplication, by having a small wrapper ksh script that does nothing
except for calling the corresponding ("twin") csh script. That at
least will allow me to implement changes only once (until I convert
all scripts to ksh).
Unfortunately however, I don't know how to run a csh script from a ksh
script, so that the ENVIRONMENT VARIABLES are inherited.
I have written the following small ksh script to test a csh script
that only export a variable named MYVAR (assigned to
"thisismyvariable"):
#! /bin/ksh
/bin/csh `which config.csh`
echo "MYVAR: ${MYVAR}"
The output is:
MYVAR:
which is not what I want. I want:
MYVAR: thisismyvariable
Which I currently only get if I run the following csh script:
#! /bin/csh
source `which config.csh`
echo "TAPELIBMAP: ${TAPELIBMAP}"
Is there any way to accomplish what I want to do?
Thanks in advance!
L.L.
I have this problem in which I "inherited" a huge system implemented
using shell scripts. This is already a maintenance nightmare, but what
makes it especially painful is that about half of the scripts are
written in ksh and half in csh. To make matters even worse, many of
the csh scripts are simply duplication of the ksh ones, so whenever a
change needs to be done, it has to be implemented in BOTH the ksh and
the csh version...
I would love to get rid of the csh scripts and convert to an all ksh
shop. However, in my work environment I cannot do it all at once - it
must be done gradually.
I was therefore thinking of starting by just eliminating the
duplication, by having a small wrapper ksh script that does nothing
except for calling the corresponding ("twin") csh script. That at
least will allow me to implement changes only once (until I convert
all scripts to ksh).
Unfortunately however, I don't know how to run a csh script from a ksh
script, so that the ENVIRONMENT VARIABLES are inherited.
I have written the following small ksh script to test a csh script
that only export a variable named MYVAR (assigned to
"thisismyvariable"):
#! /bin/ksh
/bin/csh `which config.csh`
echo "MYVAR: ${MYVAR}"
The output is:
MYVAR:
which is not what I want. I want:
MYVAR: thisismyvariable
Which I currently only get if I run the following csh script:
#! /bin/csh
source `which config.csh`
echo "TAPELIBMAP: ${TAPELIBMAP}"
Is there any way to accomplish what I want to do?
Thanks in advance!
L.L.