On Fri, Dec 22, 2006 at 10:12:55AM +0000, MJ Ray wrote:
cl@isbd.net wrote:
I still get the error:- /bin/bash: ./build: No such file or directory even though there is a build in the current directory and it's executable by me. Not to mention that sh can run it fine.
Is there a control character (often ^M) at the end of the first line? That's a pretty common cause of problems like the above - the system looks for a file called bash^M in /bin and it's not there...
I found the problem at last. I have BASH_ENV set in my environment so that a .bashrc script is executed every time I run a non-interactive bash. Thus when I run ./build the ~/.bashrc gets run. The problem is that there's a "cd /home/chris" in the .bashrc file which of course breaks things completely - as I have just seen!
I either need to change things so that I don't use BASH_ENV to run the .bashrc (I need to run it for non-login shells but not for non-interactive shells) or I need to remove that offending cd.