Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I run a .ksh containing a awk call. awk.exe and his shortcut awk is in /bin/awk, /bin is in the PATH environment variable. But when I try to launch awk, I have this error message :

bash: /usr/bin/awk: no such file or directory

Why didn't bash look for it in the /bin folder too?

edit : tar has the same rights, tar.exe is in /bin and can be listed in /usr/bin/, the exact same way than awk. Tar works fine whereas awk not.

share|improve this question
add comment

2 Answers

Does the ksh script explicitly define the path to awk? It could be via a variable ( AWK=/usr/bin/awk, invoked by $AWK). Try running which awk and alias awk, too.

Edit

Cygwin install process actually sets up /usr/bin as a hardlink to /bin. (Do ls -li /usr/ and ls -li / and you'll see the bin folders have the same inode number. Also, browse to the /usr/bin folder in windows explorer and you'll see it's empty.)

Your PATH is probably fine, but probably has /usr/bin before /bin, so it's finding awk via that route first.

Looking at your previous question, I think you might have a similar, shortcut related issue here. I tried renaming my awk.exe to dawk.exe in windows and then set up a shortcut called awk.exe pointing to it. Running awk then gives me the same error you can see. I had to force that issue, though; I think your Cygwin installation might be a bit broken, but it's hard to say how. Do you get similar errors from any other binaries?

share|improve this answer
    
/usr/bin/awk with which, awk not found with alias command –  jayjaypg22 Dec 9 '10 at 16:11
    
Even with the variable in the .ksh I 've got the error message : /usr/bin/sh: /usr/bin/awk: No such file or directory –  jayjaypg22 Dec 9 '10 at 16:18
    
I've just remembered something about Cywgin. I'll edit my post. –  SmallClanger Dec 10 '10 at 10:45
add comment

You should try an echo $PATH when you are in the korn shell. It will tell you the search path that is being used to find programs.

Alan

share|improve this answer
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.