diff --git a/etc/getVariables.py b/etc/getVariables.py index b8ad0b0d8..248f9862e 100755 --- a/etc/getVariables.py +++ b/etc/getVariables.py @@ -260,6 +260,11 @@ class CshConvert(ShellConvert): pos=val.find("export ") val=val.replace("export ","setenv ",1) val=val[:pos]+val[pos:].replace("="," ",1) + + # Prefix with a variable that tells the script that it is sourced from an alias + if val.find("source")>=0: + val=("setenv FOAM_SOURCED_FROM_ALIAS %s/tcshrc ; " % here)+val + return "alias %s '%s'" % (n,val) class TcshConvert(CshConvert): diff --git a/etc/tcshrc b/etc/tcshrc index 6a56783e8..460c290c2 100755 --- a/etc/tcshrc +++ b/etc/tcshrc @@ -31,11 +31,23 @@ # #------------------------------------------------------------------------------ -set sourced=($_) -set thisScript=($sourced[2]) +if ( $?FOAM_SOURCED_FROM_ALIAS ) then + # Sourced from an alias + set sourced=($_) + shift sourced -shift sourced -shift sourced + set thisScript=$FOAM_SOURCED_FROM_ALIAS + + # Clear the variable to make sure regular sourcing still works + unsetenv FOAM_SOURCED_FROM_ALIAS +else + # regular sourcing + set sourced=($_) + set thisScript=($sourced[2]) + + shift sourced + shift sourced +endif set thisDir=`python -c "from os.path import *;import sys;sys.stdout.write(dirname(abspath(join(curdir,'$thisScript'))))"`