zsh-workers
 help / color / mirror / code / Atom feed
* Re: zsh-4.0.1-pre4 : manpath and MANPATH
       [not found] <20010518150021.F6141@popov.bri.st.com>
@ 2001-05-18 15:05 ` Peter Stephenson
  2001-05-21  8:24   ` Richard Curnow
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2001-05-18 15:05 UTC (permalink / raw)
  To: Zsh hackers list, Richard Curnow

Richard Curnow wrote:
> zshparam.1 says that setting manpath will change MANPATH and vice versa.
> If I change MANPATH, I don't see manpath getting changed.

You haven't unset that in your .zshenv too, have you?  In that case it will
(temporarily) lose its special connection to $manpath.  This seems to be a
bug, because it happens even if $manpath is never unset.

There's a workaround (apart from the obvious one of not unsetting it in the
first place):  if you do

manpath=(${(s.:.)MANPATH})

(actually if you set $manpath to anything, but this has the side effect of
setting it to the right value) just once, they will keep track again
thereafter.

I may, or may not, get round to looking at both these bugs this weekend.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh-4.0.1-pre4 : manpath and MANPATH
  2001-05-18 15:05 ` zsh-4.0.1-pre4 : manpath and MANPATH Peter Stephenson
@ 2001-05-21  8:24   ` Richard Curnow
  2001-05-21  9:48     ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Curnow @ 2001-05-21  8:24 UTC (permalink / raw)
  To: pws; +Cc: zsh-workers

On Fri, May 18, 2001 at 04:05:11PM +0100, pws@csr.com wrote:
> Richard Curnow wrote:
> > zshparam.1 says that setting manpath will change MANPATH and vice versa.
> > If I change MANPATH, I don't see manpath getting changed.
> 
> You haven't unset that in your .zshenv too, have you?  In that case it will
> (temporarily) lose its special connection to $manpath.  This seems to be a
> bug, because it happens even if $manpath is never unset.
> 

Yes, in fact that was the case.

OK, next question ... what is a good way to delete all the environment
variables apart from 'special' ones?  Currently I have this in my .zshenv (on
Solaris)

unset `/usr/ucb/printenv | /bin/sed -e 's/=.*$//;' | egrep -v '^(PATH|HOME|HOST|LOGNAME|MACHTYPE|TERM|TZ|USER|_|PWD|DISPLAY|CLEARCASE_ROOT|SHLVL)'`

(Obviously I now need to add MANPATH to the saved list. :-))

My intention is that if I re-source .zshenv, I get the environment reset to
effectively what I would have after logging in.  Maybe just making sure all the
'special' variables like SHLVL, MANPATH etc are included would be enough, as
the method was doing what I wanted under v3.1.5.

Thanks for your help so far.
Richard

-- 
Richard Curnow---by day : SuperH Core Architecture at STMicroelectronics
curnowr@bristol.st.com---------www.superh.com-------------www.st.com----
and by night >>---richard.curnow@go.to---http://go.to/richard.curnow/---


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh-4.0.1-pre4 : manpath and MANPATH
  2001-05-21  8:24   ` Richard Curnow
@ 2001-05-21  9:48     ` Peter Stephenson
  2001-05-21 16:29       ` Bart Schaefer
  0 siblings, 1 reply; 5+ messages in thread
From: Peter Stephenson @ 2001-05-21  9:48 UTC (permalink / raw)
  To: Richard Curnow, Zsh hackers list

Richard Curnow wrote:
> OK, next question ... what is a good way to delete all the environment
> variables apart from 'special' ones?

Actually, unsetting special variables should work --- I hope we're getting
there.  Anyway...

The simplest way I can think of is to use the parameter module.  The
associative array $parameters has keys which are parameter names and values
which are the types, which contains what you want to know.  (You can get
that type information for a parameter with ${(t)paramname}, but you have to
use e.g. typeset to generate a a list of parameters to test, so this method
is a bit easier.)  Something like:

zmodload -i zsh/parameter
for param in ${(k)parameters}; do
  type=${parameters[$param]}
  [[ $type != *export* || $type = *special* ]] && continue
  unset $param
done

Somebody may be able to think of a faster way.

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh-4.0.1-pre4 : manpath and MANPATH
  2001-05-21  9:48     ` Peter Stephenson
@ 2001-05-21 16:29       ` Bart Schaefer
  2001-05-21 16:50         ` Peter Stephenson
  0 siblings, 1 reply; 5+ messages in thread
From: Bart Schaefer @ 2001-05-21 16:29 UTC (permalink / raw)
  To: Peter Stephenson, Richard Curnow, Zsh hackers list

On May 21, 10:48am, Peter Stephenson wrote:
}
} zmodload -i zsh/parameter
} for param in ${(k)parameters}; do
}   type=${parameters[$param]}
}   [[ $type != *export* || $type = *special* ]] && continue
}   unset $param
} done
} 
} Somebody may be able to think of a faster way.

A challenge, eh?  How about:

    setopt extendeglob
    unset ${(k)parameters[(R)^*(readonly*|export|special)]}

Of course this clobbers things like ZSH_NAME and ZSH_VERSION, which it
might be pretty difficult to restore to sane values.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: zsh-4.0.1-pre4 : manpath and MANPATH
  2001-05-21 16:29       ` Bart Schaefer
@ 2001-05-21 16:50         ` Peter Stephenson
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Stephenson @ 2001-05-21 16:50 UTC (permalink / raw)
  To: Zsh hackers list

Bart wrote:
> A challenge, eh?  How about:
> 
>     setopt extendeglob
>     unset ${(k)parameters[(R)^*(readonly*|export|special)]}
> 
> Of course this clobbers things like ZSH_NAME and ZSH_VERSION, which it
> might be pretty difficult to restore to sane values.

It's for parameters which *are* exported.

setopt extendedglob
unset ${(k)parameters[(R)*export*~*(readonly*|special)]}

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR Ltd., Unit 300, Science Park, Milton Road,
Cambridge, CB4 0XL, UK                          Tel: +44 (0)1223 392070


**********************************************************************
The information transmitted is intended only for the person or
entity to which it is addressed and may contain confidential 
and/or privileged material. 
Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by 
persons or entities other than the intended recipient is 
prohibited.  
If you received this in error, please contact the sender and 
delete the material from any computer.
**********************************************************************


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2001-05-22  7:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20010518150021.F6141@popov.bri.st.com>
2001-05-18 15:05 ` zsh-4.0.1-pre4 : manpath and MANPATH Peter Stephenson
2001-05-21  8:24   ` Richard Curnow
2001-05-21  9:48     ` Peter Stephenson
2001-05-21 16:29       ` Bart Schaefer
2001-05-21 16:50         ` Peter Stephenson

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).