Computing.Net > Forums > Unix > running ksh to csh script in bash

running ksh to csh script in bash

Reply to Message Icon

Original Message
Name: elpico
Date: June 15, 2005 at 03:18:28 Pacific
Subject: running ksh to csh script in bash
OS: Solaris
CPU/Ram: -
Comment:

I have my script below, which allows csh commands to be run in ksh - ie, I have a file which loads csh environments, using the setenv notation. This works fine in ksh, but doesn't work in bash - nothing gets loaded -

The reason I want it to work in bash is because lots of teams at work use it by default.

Also, we use setenv commands because of historical reasons, ie - there are older user groups that always use csh...

I have a feeling that something needs to be switched on in the bash shell to get it working, but I haven't a clue what!

See my script below:

# read $DATA/env_vars and translate from CSH to KSH commands
while read LINE ; do
echo "$LINE" | read CMD VARIABLE VALUE
export LINE VARIABLE

if [ "$CMD" == "setenv" ] ; then
/bin/csh -c 'eval $LINE;eval echo \$$VARIABLE' | read VALUE
eval $VARIABLE="$VALUE"
export $VARIABLE
echo "var is $VARIABLE"
fi

if [ "$CMD" == "set" ] ; then
/bin/csh -c 'eval $LINE;echo $path' | sed "s/ /:/g" | read PATH
fi
done < env_vars


Report Offensive Message For Removal








Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: running ksh to csh script in bash

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




How often do you use Computing.Net?

Every Day
Once a Week
Once a Month
This Is My First Time!


View Results

Poll Finishes In 4 Days.
Discuss in The Lounge