setup: etc/profile - only export var in zsh if var is actually set

arekm arekm at pld-linux.org
Thu Feb 24 20:17:49 CET 2011


Author: arekm                        Date: Thu Feb 24 19:17:49 2011 GMT
Module: setup                         Tag: HEAD
---- Log message:
- only export var in zsh if var is actually set

---- Files affected:
setup/etc:
   profile (1.55 -> 1.56) 

---- Diffs:

================================================================
Index: setup/etc/profile
diff -u setup/etc/profile:1.55 setup/etc/profile:1.56
--- setup/etc/profile:1.55	Sat Jan 22 21:08:54 2011
+++ setup/etc/profile	Thu Feb 24 20:17:44 2011
@@ -128,7 +128,18 @@
 				;;
 			* )
 				if [ -r "$i" ]; then
-					. "$i"; export "$NAME"
+					. "$i"
+					# export VAR will set and export VAR
+					# if it didn't exist before. Other shells
+					# (ksh, bash) behave differently.
+					if [ -n "$ZSH_VERSION" ]; then
+						# zsh specific
+						if [ "${(P)+NAME}" = "1" ]; then
+							export "$NAME"
+						fi
+					else
+						export "$NAME"
+					fi
 				fi
 				;;
 		esac
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/setup/etc/profile?r1=1.55&r2=1.56&f=u



More information about the pld-cvs-commit mailing list