Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

>$scriptname
$outputofscript

but

>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. –  faif Mar 28 '11 at 7:58

2 Answers 2

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

 
discard

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