Path: utzoo!attcan!uunet!mcsun!cernvax!chx400!ethz!stp From: stp@ethz.UUCP (Stephan Paschedag) Newsgroups: comp.os.os9 Subject: apath : zsh script for adding names to PATH-list Message-ID: <2882@ethz.UUCP> Date: 19 Dec 89 19:25:48 GMT Reply-To: stp@bernina.ethz.ch.UUCP (Stephan Paschedag) Organization: ETH Zuerich, Switzerland Lines: 45 This zsh script adds one or more names to the environnement variable PATH. Names that are already in the list are not added ! -------------------------- cut here ----------------------------------- @ if p0 > 0 then goto cont write "at least one argument required" write "" help: write "Syntax : apath []" write "Function : add names to the environnement variable PATH" end cont: if p1 = "-?" then goto help num = p0 loop: if num = 0 then goto term pp = env("PATH") if pp="" then goto setonly pos = index(pp,p[num]) if pos = 0 then goto add if pos = 1 then goto checkend if substr(pp,pos-1,1) <> ":" then goto add checkend: if pos+length(p[num]) > length(pp) then goto next x = pos+length(p[num]) if substr(pp,x,1) = ":" then goto next add: setenv PATH "''env("PATH")':''p[num]'" next: num = num - 1 goto loop setonly: setenv PATH "''p[num]'" goto next term: write "''env("PATH")'" end ============================================================================== OS/2 & PS/2 : half an operating system for half a computer Stephan Paschedag paschedag@strati.ethz.ch or stp@ethz.UUCP Swiss Federal Institute Of Technology Zurich ..!cernvax!ethz!stp ______________________________________________________________________________