Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Mailpath notification message

Peter Stephenson scribbled:
> Rusty Hoover wrote:
> > Shouldn't this line:
> > 
> > 	export MAILPATH="~/.mailspool/rusty:~/Mail/z?Zsh mail."
> > 
> > 			in my .zshenv give me, whenever i return to my
> > command-line prompt, the message: "Zsh mail." ?
> > 
> > It doesn't. What am i doing wrong? Do i need spaces around the question
> > mark?
> The mistake is that the ~'s are quoted, so don't expand to your home
> directory: try `echo ~ "~"' and you will see what I mean.  You need
> something like:
> export MAILPATH=~/.mailspool/rusty:~/Mail/z'?Zsh mail.'
> (zsh does know about assignments and colons when expanding ~'s).  This
> is partly my fault:  I had something in the FAQ when the shell was
> rationalised to quote tildes in this sort of place, but deleted it
> when I thought it was no longer necessary.

I usually overcome this problem by using $HOME in my scripts.  I
think this is a better way because you can put it in the middle of
double-quote quoted strings (but not single quotes.)

export MAILPATH="$HOME/mailspool/rusty:$HOME/Mail/z?Zsh mail."

IMHO its a good habit to get into.

better understand parameter expansion??

echo $HOME "$HOME" '$HOME' ~ "~" '~'

/home/wheel/dunc /home/wheel/dunc $HOME /home/wheel/dunc ~ ~

PS: what was the rationale behind quoting tildes?  Not critising
    it, but this means it isn't a short parameter ... so what is



Duncan Sargeant, http://www.ucc.gu.uwa.edu.au/~dunc/
D2: "Are you thinking what I'm thinking, D1?"
D1: "I think I am, D2!"
D1 and D2: "Free Tibet!"                    -- "Dalai Lamas in Pyjamas", GNW.

Messages sorted by: Reverse Date, Date, Thread, Author