Index: mttroot/mtt/bin/sh2csh ================================================================== --- mttroot/mtt/bin/sh2csh +++ mttroot/mtt/bin/sh2csh @@ -2,22 +2,29 @@ ############################################################### ## Version control history ############################################################### ## $Id$ ## $Log$ +## Revision 1.3 2001/04/12 03:08:00 geraint +## Improved sh->csh conversion, reduces environment namespace pollution. +## Still need to do proper if [ -z $MTT_BASE ] ... else ... fi conversion. +## ## Revision 1.2 1999/03/11 04:12:26 peterg ## Put in heading. ## ## Revision 1.1 1999/03/11 04:02:45 peterg ## Initial revision ## ############################################################### -echo Converting $1 to $1.csh - #Converts mttrc to csh form. + date=`date` +wd=`pwd` +base=`dirname $wd` + +echo Converting $1 to $1.csh using $base as default cat<$1.csh #!/bin/csh ## Automatically generated from bashrc on $date - DO NOT EDIT EOF @@ -27,12 +34,13 @@ sed 's/export[ \t]*\([A-Za-z0-9_]*\)=/setenv\ \1\ /' |\ sed 's/^\([\ \t]*\)\([A-Za-z0-9_]*\)=/set\ \2=/' |\ grep -v "if \[ -z " |\ grep -v "echo mttrc requires one argument: eg mttrc /usr/share/mtt/latest" |\ grep -v "else" |\ - grep -v -e "^fi" \ + grep -v -e "^fi" |\ + sed "s%\$1%$base%" \ >>$1.csh echo done.