zsh-users
 help / color / mirror / code / Atom feed
* alias in .zprofile - strange effect
@ 2010-08-03  8:59 Helmut Jarausch
  2010-08-03  9:44 ` Jérémie Roquet
  2010-08-03 10:54 ` Vincent Lefevre
  0 siblings, 2 replies; 3+ messages in thread
From: Helmut Jarausch @ 2010-08-03  8:59 UTC (permalink / raw)
  To: zsh-users

Hi,

I'm using zsh GIT- 2010/07/20

In my home directory I have a .zprofile file with the following lines
export PGPPATH=~/.pgp
alias lpps="lpr -Ppsloc"
alias cdc="cd ..;cd ~-"
#if [[ $DISPLAY == ':0.0' ]]; then 
#  /usr/X11R6/bin/xmodmap ~/.Xmodmap
#fi
# export OPERADIR=/usr/local/share/opera
export NEDIT_HOME=/home/jarausch/.nedit

If I enter  'cdc', ZSH doesn't know it.

But if I (re-)define it by
alias cdc="cd ..;cd ~-"

then 'cdc' is known afterwards.
And I've debugged it, .zprofile has been run during startup.

What's going on?

Many thanks for a hint,
Helmut.

-- 
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany


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

* Re: alias in .zprofile - strange effect
  2010-08-03  8:59 alias in .zprofile - strange effect Helmut Jarausch
@ 2010-08-03  9:44 ` Jérémie Roquet
  2010-08-03 10:54 ` Vincent Lefevre
  1 sibling, 0 replies; 3+ messages in thread
From: Jérémie Roquet @ 2010-08-03  9:44 UTC (permalink / raw)
  To: Zsh Users; +Cc: Helmut Jarausch

Hi,

2010/8/3 Helmut Jarausch <jarausch@igpm.rwth-aachen.de>:
> In my home directory I have a .zprofile file with the following lines
> [...]
> If I enter  'cdc', ZSH doesn't know it.
>
> But if I (re-)define it by
> alias cdc="cd ..;cd ~-"
>
> then 'cdc' is known afterwards.
> And I've debugged it, .zprofile has been run during startup.

Do you have some particular reason to use a .zprofile instead of a .zshrc ?
What is the output of " zsh --verbose |& grep alias " (without quotes) ?

Best regards,

-- 
Jérémie


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

* Re: alias in .zprofile - strange effect
  2010-08-03  8:59 alias in .zprofile - strange effect Helmut Jarausch
  2010-08-03  9:44 ` Jérémie Roquet
@ 2010-08-03 10:54 ` Vincent Lefevre
  1 sibling, 0 replies; 3+ messages in thread
From: Vincent Lefevre @ 2010-08-03 10:54 UTC (permalink / raw)
  To: zsh-users

On 2010-08-03 10:59:37 +0200, Helmut Jarausch wrote:
> And I've debugged it, .zprofile has been run during startup.

The .zprofile is sourced only by login shells. This is good for
environment variables (though I usually use .zshenv for that),
which are inherited by subprocesses, but not for aliases, which
are local to each shell instance. So, aliases need to be defined
by each shell instance. The .zshrc (sourced by interactive shells)
is generally what one wants for aliases. Of course they won't be
available in scripts.

I use a .zalias file, which I source from .zshrc:

  [[ -r ~/.zalias ]] && source ~/.zalias

and from scripts for which I want my usual aliases.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / Arénaire project (LIP, ENS-Lyon)


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

end of thread, other threads:[~2010-08-03 10:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-03  8:59 alias in .zprofile - strange effect Helmut Jarausch
2010-08-03  9:44 ` Jérémie Roquet
2010-08-03 10:54 ` Vincent Lefevre

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