Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm doing this in my .zshrc

   PATH="~/scripts:$PATH"

and if I do echo $PATH it appears as the first thing in the path. Yet this directory isn't included in the executable path (nor for tab-completion). What am I doing wrong? ls ~/scripts shows the directory as expected.

Edit: This works, though... I guess ~ doesn't work in the path?

#PATH="~/scripts:$PATH"
PATH="/Users/yar/scripts:$PATH"
share|improve this question
add comment

1 Answer

Use $HOME instead.

PATH="$HOME/scripts:$PATH"
share|improve this answer
3  
Expansion of ~ in PATH is an abhorrent bashism. The PATH-searching library functions execlp or execvp do not expand ~, so other programs that use them to find and run programs in the PATH would also fail to search ~ entries. –  Chris Johnsen May 18 '10 at 21:33
2  
I consider ~ to be a command-line convenience. It shouldn't be used in scripts and variable values for expansion. –  Dennis Williamson May 18 '10 at 23:25
    
@Chris Johnsen, it's amazing, the main impact on my *nix knowledge after switching shells is learning what is universal and what is not. I think zsh is cool, but I've learned quite a bit suffering through the switch (and I'm only two days in). @Dennis Williamson, I'm getting that, and it makes sense, somehow. –  Yar May 19 '10 at 0:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.