Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: multiple OSes



does this list allow attachments? i guess i'll find out...

lots of good ideas on how to set a path. i think i've come up with something thorough that combines a lot of the ideas presented so far, and adds some new ones...

it starts with a list from `getconf PATH` and ${path}, then adds some common paths (i'm sure it's an incomplete list). those are all fed to an array that disregards duplicate values. from there it runs through a loop to check if each directory exists (and if it's a directory), if it's owned by either root or the current user, and that the permissions of the directory are sane (you just don't want to run things from a directory that anyone can write to!). if it passes all of these tests it's added to the path.

btw, if anyone can give me a shell account on a solaris box, contact me off list. thanks...


--
        ...atom

 ________________________
 http://atom.smasher.org/
 762A 3B98 A3C3 96C9 C6B7 582A B88D 52E4 D9F5 7808
 -------------------------------------------------

	"Any society which does not insist upon respect for all
	 life must necessarily decay."
		-- Albert Einstein

#!/bin/zsh

typeset -U common_paths
common_paths=(
    ${=$(command -p getconf PATH)//:/ } ${path}
    /bin /sbin /usr/bin /usr/sbin
    /usr/local/bin /usr/local/sbin
    /usr/X11R6/bin
    /usr/pkg/bin /usr/pkg/sbin
    /usr/ccs/bin /usr/xpg4/bin /opt/local/bin /opt/local/sbin /opt/SUNWspro/bin /usr/ucb
    /usr/games
    ${HOME}/bin
)
unsetopt NOMATCH
unset PATH_test
for temp_path in ${common_paths}
do
  test -d "${temp_path}"(f?55u0,f?55u${UID}) && PATH_test="${PATH_test}${temp_path}:"
done
setopt NOMATCH
print ${PATH_test}
unset common_paths temp_path


Messages sorted by: Reverse Date, Date, Thread, Author