Listing 3: Setting PATHs for a C shell

  1	set paths = ( ~ \
  2		/usr/gnu/fileutls \
  3		 /usr/gnu/bin \
  4		/usr/gnu/groff \
  5		~/sccs \
  6		/usr/gnu/findutils-4.1 \
  7		/usr/local \
  8		/usr/bin \
  9		/bin \
 10	)
 11
 12	if ($?MANPATH)	unsetenv MANPATH	# to be safe
 13	if ($?INFOPATH) unsetenv INFOPATH
 14	# look for and add directories if they exist for toolkits
 15	foreach i ( $stuff )
 16	  if ( -d $i/bin ) then
 17		if ($?goodpath) then
 18		  setenv goodpath "$goodpath"":$i/bin"
 19		else
 20		  setenv goodpath $i/bin
 21		endif
 22	   endif
 23
 24	  if (-d $i/man) then
 25		if ($?MANPATH) then
 26		   setenv MANPATH "$MANPATH"":$i/man"
 27		else
 28		   setenv MANPATH $i/man
 29		endif
 30
 31	  endif
 32	  if (-d $i/info) then
 33		if ($?INFOPATH) then
 34		   setenv INFOPATH "$INFOPATH"":$i/info"
 35		else
 36		   setenv INFOPATH $i/info
 37		endif
 38
 39	  endif
 40	end
 41	setenv PATH "$goodpath"":/usr/ucb:/bin:/etc:/usr/etc:."
 42
 43	unset stuff


