Make sure that the aliases that source the tcshrc still work
This commit is contained in:
parent
76d193a557
commit
edc6952f57
2 changed files with 21 additions and 4 deletions
|
@ -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):
|
||||
|
|
20
etc/tcshrc
20
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'))))"`
|
||||
|
||||
|
|
Reference in a new issue