Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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

There is an executable in my path that I believe is a perl script.



>which $scriptname
which:  0652-141 There is no $scriptname in $path

and the path it prints is the same that echo $PATH gives (except space delimited rather than colon).

Running ksh again does not appear to change my path, but now the script is not found.

This is as a normal user running ksh on AIX 6.1 over telnet (yeah, I know).

share|improve this question
Obvious comment, but check the script has executable permissions. – Faheem Mitha Mar 27 '11 at 22:49
Does whereis work in both cases? If yes, $PATH is somehow changed. – ierax Mar 28 '11 at 7:58
up vote 2 down vote accepted

Running type $scriptname told me that it was an alias. Apparently this prevented it from being found by which.

share|improve this answer
Oh right, I should have mentioned that too. See that previous related question. which is an external command and doesn't see aliases or functions. Prefer type or (if available) whence. – Gilles Mar 27 '11 at 23:48

which is a csh script on AIX, and it might use a different path. But that doesn't seem to be exactly your problem, since which prints the expected path.

Are you absolutely sure you didn't have a different path in the first ksh session? Running ksh again might have changed the PATH because it ran ~/.kshrc or $ENV. (And just to be sure, does the script still exist, or could it simply have been deleted in the meantime?)

share|improve this answer
Positive that the script was not deleted - it worked again afterwards. echo $PATH produced the same output in the inner and outer ksh, but perhaps it's possible for that to be wrong or misleading? – user6091 Mar 27 '11 at 23:37

Your Answer


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