delorie.com/archives/browse.cgi | search |
Howdy, Is there a reason why a relative path in a PATH variable can't be used to locate a command/script to be executed by bash/sh? Here is an example of what I mean: > bash-2.02$ cd i:/tmp > bash-2.02$ ls foobar barfoo > barfoo: > > foobar: > foo > bash-2.02$ foobar/foo > hi there > bash-2.02$ cd barfoo > bash-2.02$ foo > bash: foo: command not found > bash-2.02$ echo $PATH > /apps/work/cygnus/CYGWIN~1/H-I586~1/bin://C/WINNT40/system32://C/WINNT40:/apps/w > ork/Personal_Communications:/apps/WinDbg/Bin:/apps/WinDbg/Bin/WinNT:/tools/msvc4 > 1/BIN://C/WIN98://C/WIN98/COMMAND://C/DOS > bash-2.02$ PATH=$PATH:../foobar > bash-2.02$ foo > foo: Can't open foo > bash-2.02$ ls /bin/sh > /bin/sh > bash-2.02$ cat ../foobar/foo > #!/bin/sh > > echo hi there > bash-2.02$ ../foobar/foo > hi there > bash-2.02$ It seems that bash sees the file, but cannot grok the #!/bin/sh or something like this. Notice the message changes after I added the relative path to the PATH variable. It was 'command not found' before I changed PATH. After PATH was updated, the message changed to "foo: Can't open foo". I searched Users Guide, the FAQ, and the mail archives for August and July and I do not see any information on restrictions on the use of relative paths. I tried to search for "Can't open" in the search engine and didn't any hits on that either. However, even simple queries for things like PATH and path don't return results either. This makes me think the search engine is broken or something :-( Did I miss something important? Note that it is helpful to use relative paths in places like a build environment when make sets PATH each time it launches in a sub-directory relative to fixed location. Thank you, Rob -- Want to unsubscribe from this list? Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |