Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: multiple OSes
- X-seq: zsh-users 12174
- From: Atom Smasher <atom@xxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: multiple OSes
- Date: Fri, 2 Nov 2007 21:33:31 +1300 (NZDT)
- In-reply-to: <23615.1193936637@thecus>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- Openpgp: id=0xB88D52E4D9F57808; algo=1 (RSA); size=4096; url=http://atom.smasher.org/pgp.txt
- References: <20071101093453.40647.qmail@xxxxxxxxxxx> <23405.1193932961@thecus> <E9A8A335-5E08-4C06-B924-B950CD81B4E3@xxxxxxxxx> <23615.1193936637@thecus>
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