zsh-users
 help / color / mirror / code / Atom feed
* path problem when zsh is a login shell
@ 2015-07-14 16:18 covici
  2015-07-14 17:11 ` Kurtis Rader
  0 siblings, 1 reply; 3+ messages in thread
From: covici @ 2015-07-14 16:18 UTC (permalink / raw)
  To: zsh-users

I am new to zsh, so please be patient.  So if I use zsh as a login shell
I have in my /etc/zshenv
if [ -e /etc/profile.env ] ; then
	. /etc/profile.env
fi
umask 027
path=(
$PATH
)
Now tha /etc/profile.env puts amoung other things, lots of things on the
path.  
Now in my .zprofile, I have on line 71 or thereabouts mkdir which is
not found and the path is apparently messed up in some way -- so what
strange thing am I doing wrong?

Thanks in advance for any suggestions.

Here is my .zprofile

#
# Executes commands at login pre-zshrc.
#
# Authors:
#   Sorin Ionescu <sorin.ionescu@gmail.com>
#

#
# Browser
#

if [[ "$OSTYPE" == darwin* ]]; then
  export BROWSER='open'
fi

#
# Editors
#

export EDITOR='emacs'
export VISUAL='emacs'
export PAGER='less'

#
# Language
#

if [[ -z "$LANG" ]]; then
  export LANG='en_US.UTF-8'
fi

#
# Paths
#

# Ensure path arrays do not contain duplicates.
typeset -gU cdpath fpath mailpath path

# Set the the list of directories that cd searches.
# cdpath=(
#   $cdpath
# )

# Set the list of directories that Zsh searches for programs.

path=(
$PATH:/usr/sbin:/sbin:$HOME/bin
)


# Less
#

# Set the default Less options.
# Mouse-wheel scrolling has been disabled by -X (disable screen clearing).
# Remove -X and -F (exit if the content fits on one screen) to enable it.
export LESS='-F -g -i -M -R -S -w -X -z-4'

# Set the Less input preprocessor.
# Try both `lesspipe` and `lesspipe.sh` as either might exist on a system.
if (( $#commands[(i)lesspipe(|.sh)] )); then
  export LESSOPEN="| /usr/bin/env $commands[(i)lesspipe(|.sh)] %s 2>&-"
fi

#
# Temporary Files
#

if [[ ! -d "$TMPDIR" ]]; then
  export TMPDIR="/tmp/$LOGNAME"
  mkdir -p -m 700 "$TMPDIR"
fi

TMPPREFIX="${TMPDIR%/}/zsh"


-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

* Re: path problem when zsh is a login shell
  2015-07-14 16:18 path problem when zsh is a login shell covici
@ 2015-07-14 17:11 ` Kurtis Rader
  2015-07-14 17:57   ` covici
  0 siblings, 1 reply; 3+ messages in thread
From: Kurtis Rader @ 2015-07-14 17:11 UTC (permalink / raw)
  To: covici; +Cc: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 1045 bytes --]

On Tue, Jul 14, 2015 at 9:18 AM, <covici@ccs.covici.com> wrote:

> I am new to zsh, so please be patient.  So if I use zsh as a login shell
> I have in my /etc/zshenv
> if [ -e /etc/profile.env ] ; then
>         . /etc/profile.env
> fi
> umask 027
> path=(
> $PATH
> )
>

Don't do that. $PATH is a colon separated sequence of directories. It's a
single string. When you do the array assignment you are assigning to the
"path" array a single string. For example, if $PATH is set to "/a:/b:/c"
when you execute

echo $#path $path

you should see this line printed:

3 /a /b /c

Now execute

path=( $PATH )
echo $#path $path

Notice that the path array now contains a single word:

1 /a:/b:/c

Since you probably don't have a directory named "/a:/b:/c" no non-builtin
commands will be found.

Also, $path and $PATH are already bound together which means that if you
change one you're automatically changing the other. In other words, you
don't need to assign to both of them.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

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

* Re: path problem when zsh is a login shell
  2015-07-14 17:11 ` Kurtis Rader
@ 2015-07-14 17:57   ` covici
  0 siblings, 0 replies; 3+ messages in thread
From: covici @ 2015-07-14 17:57 UTC (permalink / raw)
  To: Kurtis Rader; +Cc: Zsh Users

Thanks for your quick response -- yup, it worked just fine.  Now all I
have to do is search prezto and get rid of some of those strange aliases
they have.

Kurtis Rader <krader@skepticism.us> wrote:

> On Tue, Jul 14, 2015 at 9:18 AM, <covici@ccs.covici.com> wrote:
> 
> > I am new to zsh, so please be patient.  So if I use zsh as a login shell
> > I have in my /etc/zshenv
> > if [ -e /etc/profile.env ] ; then
> >         . /etc/profile.env
> > fi
> > umask 027
> > path=(
> > $PATH
> > )
> >
> 
> Don't do that. $PATH is a colon separated sequence of directories. It's a
> single string. When you do the array assignment you are assigning to the
> "path" array a single string. For example, if $PATH is set to "/a:/b:/c"
> when you execute
> 
> echo $#path $path
> 
> you should see this line printed:
> 
> 3 /a /b /c
> 
> Now execute
> 
> path=( $PATH )
> echo $#path $path
> 
> Notice that the path array now contains a single word:
> 
> 1 /a:/b:/c
> 
> Since you probably don't have a directory named "/a:/b:/c" no non-builtin
> commands will be found.
> 
> Also, $path and $PATH are already bound together which means that if you
> change one you're automatically changing the other. In other words, you
> don't need to assign to both of them.
> 
> -- 
> Kurtis Rader
> Caretaker of the exceptional canines Junior and Hank

-- 
Your life is like a penny.  You're going to lose it.  The question is:
How do
you spend it?

         John Covici
         covici@ccs.covici.com


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

end of thread, other threads:[~2015-07-14 17:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 16:18 path problem when zsh is a login shell covici
2015-07-14 17:11 ` Kurtis Rader
2015-07-14 17:57   ` covici

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