zsh-users
 help / color / mirror / code / Atom feed
* $PATH
@ 2001-07-10  5:28 Will Yardley
  2001-07-10  8:17 ` $PATH Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Will Yardley @ 2001-07-10  5:28 UTC (permalink / raw)
  To: zsh-users

I haven't been able to figure this one out; sorry for asking such a dumb
question.  I generally put pretty much all my stuff in my .zshrc.  i've
noticed that if i do something like:
PATH=$PATH:/dh/bin
or whatever, each time i open a new shell (ie if i type 'zsh') my new shell
has the arg appended twice, so it would be something like:
yakko% zsh
yakko% echo $PATH
/usr/bin:/bin:/usr/sbin:/sbin:/dh/bin:/dh/bin

however if i open a root shell (ie sudo zsh) using sudo, the path is only
appended once (i guess this is treated as a new login shell or whatever).

I can solve this by putting the line in my .zprofile or .zlogin instead; however then,
when I type 'sudo zsh', the extra item isn't appended at all.  if i put it in
~root/.zprofile it doesn't work either.

is there a simple solution i'm overlooking here?

-will


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

* Re: $PATH
  2001-07-10  5:28 $PATH Will Yardley
@ 2001-07-10  8:17 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2001-07-10  8:17 UTC (permalink / raw)
  To: Will Yardley, zsh-users

On Jul 9, 10:28pm, Will Yardley wrote:
} Subject: $PATH
}
} noticed that if i do something like:
} PATH=$PATH:/dh/bin
} or whatever, each time i open a new shell (ie if i type 'zsh') my new shell
} has the arg appended twice
} 
} is there a simple solution i'm overlooking here?

Use the `path' array instead of the PATH scalar, and use `typeset -U'.

typeset -U path
path=($path /dh/bin)

Recent versions of zsh, e.g. 3.1.9/4.0.x, also allow `typeset -U' of a
colon-separated scalar like PATH, but the above will work in most 3.0.x
versions as well.

-- 
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] 2+ messages in thread

end of thread, other threads:[~2001-07-10  8:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-10  5:28 $PATH Will Yardley
2001-07-10  8:17 ` $PATH Bart Schaefer

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).