Major speedup in constructing path:

Replaced "if egrep" with "case".
This commit is contained in:
hjp 1997-07-19 14:25:48 +00:00
parent 48a264fcf4
commit 4321f21261
4 changed files with 42 additions and 12 deletions

View File

@ -4,3 +4,4 @@ if [ "`uname`" = "HP-UX" ]
then
ps -fu $LOGNAME
fi
date

View File

@ -5,3 +5,12 @@ if [ -f "$EXEC" ]
then
source $EXEC
fi
sock=`findsock $$`
if [ -z "$sock" ]
then
vhost=`hostname`
else
vhost="$sock"
fi
vhost=`echo "$vhost" | cut -d . -f 1`

19
.zshenv
View File

@ -40,7 +40,7 @@ export LPDEST=wsrplj51
# set PATH to direcories *I* want.
PRIVATE_PATH=/usr/local/alpha/mt/bin:$HOME/bin/scripts:$HOME/bin
ETC_PATH=/usr/local/etc:/usr/etc:/etc:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/samba/bin
ETC_PATH=/usr/local/etc:/usr/etc:/etc:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/samba/bin:/opt/omni/sbin:/opt/omni/lbin
BIN_PATH=/usr/local/bin:/usr/softbench/bin:/usr/vue/bin:/usr/bin/X11:/bin:/usr/bin:/usr/local/bin/X11
if [ -r /etc/PATH ]
then
@ -50,24 +50,33 @@ fi
ALL_PATH=$PRIVATE_PATH:$ETC_PATH:$BIN_PATH:$PATH
NEW_PATH=""
date
for i in ${(s/:/)ALL_PATH}
do
if test -d "$i"
then
if echo "$NEW_PATH" | egrep '(^|:)'"$i"'(:|$)' > /dev/null
then
else
case "$NEW_PATH" in
$i:*|*:$i|*:$i:*) ;;
*)
if test -z "$NEW_PATH"
then
NEW_PATH=$i
else
NEW_PATH=$NEW_PATH:$i
fi
fi
esac
fi
done
export PATH=$NEW_PATH
date
if [ -r /etc/MANPATH ]
then
MANPATH=`cat /etc/MANPATH`:$MANPATH
fi
case "`uname -sr`" in
HP-UX*09.*)
export LANG=${LANG:-american.iso88591}

View File

@ -1,12 +1,23 @@
include GNUmakerules
install: \
$(HOME)/.zlogin \
$(HOME)/.zlogout \
$(HOME)/.znewterm \
$(HOME)/.zprofile \
$(HOME)/.zshenv \
$(HOME)/.zshrc
ALLSRC = \
.zlogin \
.zlogout \
.znewterm \
.zprofile \
.zshenv \
.zshrc \
ALLDST = $(subst ., $(HOME)/., $(ALLSRC))
install: $(ALLDST)
echo:
echo $(ALLSRC)
echo $(ALLDST)
$(HOME)/%: %
$(INSTALL) $^ $@
diff:
for i in $(ALLSRC); do diff -u $(HOME)/$$i $$i; done