[comp.os.os9] apath : zsh script for adding names to PATH-list

stp@ethz.UUCP (Stephan Paschedag) (12/20/89)

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 [<path>]"
  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
______________________________________________________________________________

njc@nsscb.UUCP (Neil Cherry) (12/20/89)

Where can I get a copy of ZSH, I have TOPS CSH which is very nice. But a shell
with more capabilities like Bourne scripts would be nice. (KSH on OS9 would be
great, but 1 step at a time.)
NJC

ram@floenz1.UUCP (Reimer Mellin) (12/23/89)

In article <2882@ethz.UUCP> stp@bernina.ethz.ch.UUCP (Stephan Paschedag) writes:
} This zsh script adds one or more names to the environnement variable PATH.

what is this zsh ?
with the minix-sh u do the following:
'setenv PATH $PATH:xxxxxxx'

regards
	Reimer

ram@floenz1.UUCP (Reimer Mellin) (12/23/89)

In article <1176@nsscb.UUCP> njc@nsscb.UUCP (Neil Cherry (STARGRP)) writes:
} Where can I get a copy of ZSH, I have TOPS CSH which is very nice. But a shell
} with more capabilities like Bourne scripts would be nice. (KSH on OS9 would be
} great, but 1 step at a time.)

forget zsh:
	- mysterious script-language ... :-)
	- not bounce sh compatible ...
	- silly installation (feeling like wordstar, no termcap-usage)
	- not free, u pay about 500 DM (250$)

Get the new TOPS release (release 2), which will be FINALLY (sigh)
available by beginning of 1990. with that u will get an adaption/enhancement
of the minix-sh, which looks like a crossing between ksh and csh.
(more ksh btw)

Regards
	Reimer