From 7def1e6da17e739c326c1fdead6e2b2a3aa5a53e Mon Sep 17 00:00:00 2001 From: "Bernhard F.W. Gschaider" Date: Thu, 5 Sep 2013 01:31:14 +0200 Subject: [PATCH] What works in tcsh doesn't work in csh (although most systems nowadays use tcsh as csh) --HG-- branch : bgschaid/minorAdditionsBranch --- etc/cshrc | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/etc/cshrc b/etc/cshrc index ece4c2b1b..fb381bba0 100644 --- a/etc/cshrc +++ b/etc/cshrc @@ -36,21 +36,33 @@ unset WM_PROJECT_VERSION_ADDITION unsetenv WM_PROJECT_VERSION_ADDITION set called=($_) -set prefSettingFile=$called[2].preset +if ( $#called != 1 ) then + # tcsh - csh doesn't know about the location + set thisScript=$called[2] + set prefSettingFile=$thisScript.preset -if ( -r $prefSettingFile ) then - # echo "Found presettings $prefSettingFile" - source $prefSettingFile + if ( -r $prefSettingFile ) then + # echo "Found presettings $prefSettingFile" + source $prefSettingFile + endif +else + echo "csh - WM_PROJECT_VERSION_ADDITION not supported" endif setenv WM_PROJECT OpenFOAM setenv WM_PROJECT_VERSION 1.6-ext -if( ! $?WM_PROJECT_VERSION_ADDITION ) then - setenv WM_PROJECT_VERSION_ADDITION `python -c "from os.path import *;print abspath(join(curdir,'$called[2]')).split(sep)[-3][len('OpenFOAM-$WM_PROJECT_VERSION')+1:]"` - unset called +if ( $#called != 1 ) then + if( ! $?WM_PROJECT_VERSION_ADDITION ) then + setenv WM_PROJECT_VERSION_ADDITION `python -c "from os.path import *;print abspath(join(curdir,'$thisScript')).split(sep)[-3][len('OpenFOAM-$WM_PROJECT_VERSION')+1:]"` + if ( "$WM_PROJECT_VERSION_ADDITION" == "" ) then + unsetenv WM_PROJECT_VERSION_ADDITION + endif + endif + unset prefSettingFile thisScript endif -unset prefSettingFile called + +unset called if ( $?WM_PROJECT_VERSION_ADDITION ) then setenv WM_PROJECT_VERSION $WM_PROJECT_VERSION-$WM_PROJECT_VERSION_ADDITION @@ -100,8 +112,9 @@ alias _foamSource 'if ($?FOAM_VERBOSE && $?prompt) echo "Sourcing: \!*"; source # Add in preset user or site preferences: set foamPrefs=`$WM_PROJECT_DIR/bin/foamEtcFile prefs.csh` + if ( $status == 0 ) then - if ( $?foamPrefs ) then + if ( "$foamPrefs" != "" ) then _foamSource $foamPrefs endif endif