]> git.pld-linux.org Git - projects/setup.git/commitdiff
- optimize: skip three grep executions
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 6 Mar 2005 15:11:19 +0000 (15:11 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Sun, 6 Mar 2005 15:11:19 +0000 (15:11 +0000)
Changed files:
    etc/profile -> 1.46

etc/profile

index 4247ef8ec32fc992b99e56e6f760c5ddc537430b..3b5d35f9c519f63aea8badaf7d9547548a2d73f9 100644 (file)
@@ -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
This page took 0.107158 seconds and 4 git commands to generate.