summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrell Anderson <[email protected]>2012-03-05 22:15:10 -0600
committerDarrell Anderson <[email protected]>2012-03-05 22:15:10 -0600
commit30a104067d53f6f21346dad378fe4fb90c790167 (patch)
treec0297b5b8c8a0db06c61d6471d30ba939d26eb27
parent5515785d64e04f6290b32cb3b859a06957b2d1a6 (diff)
downloadtdebase-30a104067d53f6f21346dad378fe4fb90c790167.tar.gz
tdebase-30a104067d53f6f21346dad378fe4fb90c790167.zip
Reduce path tests for $TDEDIR/games and $TDEDIR/bin to one regex command each.
-rw-r--r--starttde16
1 files changed, 4 insertions, 12 deletions
diff --git a/starttde b/starttde
index d06fdb111..8a66c7455 100644
--- a/starttde
+++ b/starttde
@@ -156,12 +156,8 @@ if [ -d $TDEDIR/games ]; then
# search patch is respected.
# Is there a way we can check that $TDEDIR/games is always placed only just before
# /usr/games in the search path?
- if [ "`echo $PATH | grep \"^/usr/games:\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|^/usr/games:|$TDEDIR/games:/usr/games:|\"`"
- elif [ "`echo $PATH | grep \":/usr/games$\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|:/usr/games$|:$TDEDIR/games:/usr/games|\"`"
- elif [ "`echo $PATH | grep \":/usr/games:\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|:/usr/games:|:$TDEDIR/games:/usr/games:|\"`"
+ if [ "`echo $PATH | grep \"^\\(.*:\\)\\?/usr/games\\(:.*\\)\\?$\"`" != "" ]; then
+ export PATH="`echo $PATH | sed \"s|^\\(.*:\\)\\?/usr/games\\(:.*\\)\\?$|\\1$TDEDIR/games:/usr/games\\2|\"`"
else
export PATH=$TDEDIR/games:$PATH
fi
@@ -175,12 +171,8 @@ if [ -d $TDEDIR/bin ]; then
# elsewhere, then they need to ensure the traditional search patch is respected.
# Is there a way we can check that $TDEDIR/bin is always placed only just before
# /usr/bin in the search path?
- if [ "`echo $PATH | grep \"^/usr/bin:\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|^/usr/bin:|$TDEDIR/bin:/usr/bin:|\"`"
- elif [ "`echo $PATH | grep \":/usr/bin$\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|:/usr/bin$|:$TDEDIR/bin:/usr/bin|\"`"
- elif [ "`echo $PATH | grep \":/usr/bin:\"`" != "" ]; then
- export PATH="`echo $PATH | sed \"s|:/usr/bin:|:$TDEDIR/bin:/usr/bin:|\"`"
+ if [ "`echo $PATH | grep \"^\\(.*:\\)\\?/usr/bin\\(:.*\\)\\?$\"`" != "" ]; then
+ export PATH="`echo $PATH | sed \"s|^\\(.*:\\)\\?/usr/bin\\(:.*\\)\\?$|\\1$TDEDIR/bin:/usr/bin\\2|\"`"
else
export PATH=$TDEDIR/bin:$PATH
fi