diff options
author | Darrell Anderson <humanreadable@yahoo.com> | 2012-03-05 22:15:10 -0600 |
---|---|---|
committer | Darrell Anderson <humanreadable@yahoo.com> | 2012-03-05 22:15:10 -0600 |
commit | 30a104067d53f6f21346dad378fe4fb90c790167 (patch) | |
tree | c0297b5b8c8a0db06c61d6471d30ba939d26eb27 /starttde | |
parent | 5515785d64e04f6290b32cb3b859a06957b2d1a6 (diff) | |
download | tdebase-30a104067d53f6f21346dad378fe4fb90c790167.tar.gz tdebase-30a104067d53f6f21346dad378fe4fb90c790167.zip |
Reduce path tests for $TDEDIR/games and $TDEDIR/bin to one regex command each.
Diffstat (limited to 'starttde')
-rw-r--r-- | starttde | 16 |
1 files changed, 4 insertions, 12 deletions
@@ -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 |