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 am having problems with symbolic links and the $PATH variable.

I have a directory:

# /usr/rulerX/square

where /usr/rulerX/square is a symbolic link such that:

# ls -la
square --> square.hg.current

My path variable is set as:

# echo $PATH

I have a file, runSquare, under /usr/rulerX/square.hg.current/bin/

Here's the problem:

# runSquare
runSquare: Command Not Found

What gives? If I set /usr/rulerX/square.hg.current/bin to the PATH; everything works fine. However, if I have the symbolic link (just 'square'), it can't find the file.

  • I am using CentOS with csh
share|improve this question

migrated from Sep 18 '10 at 12:25

This question came from our site for professional and enthusiast programmers.

setenv PATH /usr/rulerX/square/bin:$PATH will NOT allow me to execute. – Carlo del Mundo Sep 17 '10 at 15:32
setenv PATH /usr/rulerX/square.hg.current/bin:$PATH however WILL allow me. What's the matter here? – Carlo del Mundo Sep 17 '10 at 15:33
It is good idea to avoid running as root as much as possible. Consider sticking to an unprivileged account and using sudo on those operation that require elevated privilege. – dmckee Sep 17 '10 at 15:48

Some shells (including csh and derivatives) maintain a preprocessed list of files in the directories along PATH to increase searching speed. If your shell is doing that you need to instruct it to rebuild the list.

Typically there is a shell built-in for this, and it is often called rehash.

share|improve this answer

Nevermind; it appears that after a few minutes; the $PATH to /bin/ propagated to the symbolic link.

It could be a bug?

share|improve this answer

You must log in to answer this question.

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