summaryrefslogtreecommitdiff
path: root/share/spack/csh/pathadd.csh
diff options
context:
space:
mode:
Diffstat (limited to 'share/spack/csh/pathadd.csh')
-rw-r--r--share/spack/csh/pathadd.csh17
1 files changed, 13 insertions, 4 deletions
diff --git a/share/spack/csh/pathadd.csh b/share/spack/csh/pathadd.csh
index 4390a788d0..0f8a04ba62 100644
--- a/share/spack/csh/pathadd.csh
+++ b/share/spack/csh/pathadd.csh
@@ -12,17 +12,26 @@
# otherwise append to that variable.
set _pa_varname = PATH;
set _pa_new_path = $_pa_args[1];
-[ $#_pa_args -gt 1 ] && set _pa_varname = $_pa_args[1] && set _pa_new_path = $_pa_args[2];
+
+if ($#_pa_args > 1) then
+ set _pa_varname = $_pa_args[1]
+ set _pa_new_path = $_pa_args[2]
+endif
# Check whether the variable is set yet.
set _pa_old_value = ""
eval set _pa_set = '$?'$_pa_varname
-[ $_pa_set -eq 1 ] && eval set _pa_old_value='$'$_pa_varname;
+if ($_pa_set == 1) then
+ eval set _pa_old_value='$'$_pa_varname
+endif
# Do the actual prepending here, if it is a dir and not already in the path
if ( -d $_pa_new_path && \:$_pa_old_value\: !~ *\:$_pa_new_path\:* ) then
- [ -n "$_pa_old_value" ] && setenv $_pa_varname $_pa_new_path\:$_pa_old_value
- [ -z "$_pa_old_value" ] && setenv $_pa_varname $_pa_new_path
+ if ("x$_pa_old_value" == "x") then
+ setenv $_pa_varname $_pa_new_path
+ else
+ setenv $_pa_varname $_pa_new_path\:$_pa_old_value
+ endif
endif
unset _pa_args _pa_new_path _pa_old_value _pa_set _pa_varname