X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.7 required=5.0 tests=AWL,BAYES_00,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org From: "Rockefeller, Harry" To: "cygwin AT cygwin DOT com" Date: Wed, 19 May 2010 13:45:17 -0500 Subject: RE: bash - command - PATH question Message-ID: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F6F@srv060ex01.ssd.fsi.com> References: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F0B AT srv060ex01 DOT ssd DOT fsi DOT com> <4BF3FC7A DOT 8030705 AT bopp DOT net> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F33 AT srv060ex01 DOT ssd DOT fsi DOT com> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F41 AT srv060ex01 DOT ssd DOT fsi DOT com> <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F57 AT srv060ex01 DOT ssd DOT fsi DOT com> In-Reply-To: <3185EFAF9C8F7B4E9DBDF56829BF7C78378E8F57@srv060ex01.ssd.fsi.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com After more testing, where "export PATH=3D$PATH:~/bin" only exists in .bash_login. If I run 'foo' from my login directory it works. If I then cd to a different place I get the error bash: ./bin/foo: No such file or directory which is true since I cd'd away from home *BUT* when I *first* ran foo ~/bin was the same as ./bin and is where foo lives. If I don't run foo from my home directory first, i.e., cd away and then run foo it works. The problem seems to be an execuatable system Memory which essentially says yes I found foo at ./bin and then catalogs this to save time later when foo is run. But, when cd'd away from home ./bin no longer has foo and the error occurs. This dynamic system memory to reexecute commands faster seems to be confusing ~/bin with ./bin. -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of= Rockefeller, Harry Sent: Wednesday, May 19, 2010 11:22 AM To: cygwin AT cygwin DOT com Subject: RE: bash - command - PATH question I double and triple checked for DOS things \r, ^M, etc. I use emacs to edit and so it's pretty clear about DOS things. Anyway, I ran od -c on files and outputs of 'echo $PATH', etc. I compared PATH in normal shell with PATH after=20 spawning a new bash, since the command worked in the new bash. The only difference in PATH is that ":/cygdrive/c/DOCUME~1/harryr/bin" was appended to PATH. This is understandable since my .bashrc does "export PATH=3D$PATH:~/bin". So, in my normal shell where the error was happening I next tried this: PATH=3D$PATH:~/bin and low and behold foo ran correctly. FWIW, /cygdrive/c/DOCUME~1/harryr/bin is in PATH twice now, both at the end. I agree that the shebang is normaly the problem. But all this=20 difference in behavior is external to foo. -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of= Rockefeller, Harry Sent: Wednesday, May 19, 2010 10:38 AM To: cygwin AT cygwin DOT com Subject: RE: bash - command - PATH question I found that if I give the simple 'bash' command to create a new shell then type 'foo' it does work. [quote on] -----Original Message----- From: cygwin-owner AT cygwin DOT com [mailto:cygwin-owner AT cygwin DOT com] On Behalf Of= Andrew DeFaria Sent: Wednesday, May 19, 2010 10:28 AM To: cygwin AT cygwin DOT com Subject: Re: bash - command - PATH question Again, have you tried dos2unix foo? On 05/19/2010 08:16 AM, Rockefeller, Harry wrote: >> On 5/19/2010 8:50 AM, Rockefeller, Harry wrote: >>=20=20=20=20=20=20 >>> Given that 'foo' is a bash script, why is it that: >>> >>> $ foo >>> >>> returns the error: >>> >>> bash: ./bin/foo: No such file or directory >>>=20=20=20=20=20=20=20=20 >=20=20=20=20 >> What happens when you directly run ./bin/foo? >>=20=20=20=20=20=20 > I get exactly the same error. The error is correct. > ./bin/foo doesn't exist. (I'm not in home directory when > I issue the command.) > >=20=20=20=20 >> What is the shebang (first line) of foo? >>=20=20=20=20=20=20 > #!/bin/bash > I thought it might have something to do with this and tried commenting > It out but nothing changed. > >=20=20=20=20 >>> BUT since foo is *really in* PATH, e.g., >>> >>> $ `which foo` >>> >>> runs correctly? >>>=20=20=20=20=20=20=20=20 >=20=20=20=20 >> What is the output of "which foo" in this case? >>=20=20=20=20=20=20 > /cygdrive/c/DOCUME~1/harryr/bin/foo > [quote off] -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple