Author: glen Date: Sun Mar 6 15:11:24 2005 GMT
Module: setup Tag: HEAD
---- Log message:
- optimize: skip three grep executions
---- Files affected:
setup/etc:
profile (1.45 -> 1.46)
---- Diffs:
================================================================
Index: setup/etc/profile
diff -u setup/etc/profile:1.45 setup/etc/profile:1.46
--- setup/etc/profile:1.45 Sun Mar 6 16:10:35 2005
+++ setup/etc/profile Sun Mar 6 16:11:19 2005
@@ -4,9 +4,13 @@
# System wide environment and startup programs
# Functions and aliases go into the shells dependent startup files
-echo "$PATH" | grep -q /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin"
-echo "$PATH" | grep -q /usr/local/bin || PATH="$PATH:/usr/local/bin"
-echo "$PATH" | grep -q "$HOME/bin" || PATH="$PATH:$HOME/bin"
+# returns TRUE if $1 contains $2
+strstr() {
+ [[ $1 = *$2* ]] && return 0 || return 1
+}
+strstr "$PATH" /usr/X11R6/bin || PATH="$PATH:/usr/X11R6/bin"
+strstr "$PATH" /usr/local/bin || PATH="$PATH:/usr/local/bin"
+strstr "$PATH" "$HOME/bin" || PATH="$PATH:$HOME/bin"
USER=`id -un`
LOGNAME=$USER
================================================================
---- CVS-web:
http://cvs.pld-linux.org/setup/etc/profile?r1=1.45&r2=1.46&f=u
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit