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 then
ps -fu $LOGNAME ps -fu $LOGNAME
fi fi
date

View File

@ -5,3 +5,12 @@ if [ -f "$EXEC" ]
then then
source $EXEC source $EXEC
fi 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. # set PATH to direcories *I* want.
PRIVATE_PATH=/usr/local/alpha/mt/bin:$HOME/bin/scripts:$HOME/bin 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 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 ] if [ -r /etc/PATH ]
then then
@ -50,24 +50,33 @@ fi
ALL_PATH=$PRIVATE_PATH:$ETC_PATH:$BIN_PATH:$PATH ALL_PATH=$PRIVATE_PATH:$ETC_PATH:$BIN_PATH:$PATH
NEW_PATH="" NEW_PATH=""
date
for i in ${(s/:/)ALL_PATH} for i in ${(s/:/)ALL_PATH}
do do
if test -d "$i" if test -d "$i"
then then
if echo "$NEW_PATH" | egrep '(^|:)'"$i"'(:|$)' > /dev/null case "$NEW_PATH" in
then $i:*|*:$i|*:$i:*) ;;
else *)
if test -z "$NEW_PATH" if test -z "$NEW_PATH"
then then
NEW_PATH=$i NEW_PATH=$i
else else
NEW_PATH=$NEW_PATH:$i NEW_PATH=$NEW_PATH:$i
fi fi
fi esac
fi fi
done done
export PATH=$NEW_PATH export PATH=$NEW_PATH
date
if [ -r /etc/MANPATH ]
then
MANPATH=`cat /etc/MANPATH`:$MANPATH
fi
case "`uname -sr`" in case "`uname -sr`" in
HP-UX*09.*) HP-UX*09.*)
export LANG=${LANG:-american.iso88591} export LANG=${LANG:-american.iso88591}

View File

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