Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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. – Dan Rosenstark May 19 '10 at 0:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .