delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1996/12/22/15:37:03

From: richardd AT cix DOT compulink DOT co DOT uk (Richard Donkin)
Subject: b17.1 - bash confused by directory name = script name
22 Dec 1996 15:37:03 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <memo.786514.cygnus.gnu-win32@cix.compulink.co.uk>
Reply-To: richardd AT cix DOT compulink DOT co DOT uk
Original-To: gnu-win32 AT cygnus DOT com
Original-Cc: richardd AT cix DOT compulink DOT co DOT uk
Original-Sender: owner-gnu-win32 AT cygnus DOT com

I have a shell script called 'man' that is in the path and works fine from 
bash unless the current working directory has a directory called 'man' 
within it.  For example:

chanrossa(1) rcs-5.7$ pwd
/usr/local/src/rcs-5.7
chanrossa(1) rcs-5.7$ ls -ld man
drwxr-xr-x  32 500      everyone        0 Jan 01  1970 man
chanrossa(1) rcs-5.7$ type -a man
man is /USR/LOCAL/BIN/man
chanrossa(1) rcs-5.7$ head -3 /usr/local/bin/man
#!/bin/sh
# man: show man page
set -x
chanrossa(1) rcs-5.7$ man diff3
man: man: Permission denied
^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: bash seems to find the shell script OK, then somehow when starting up 
the subshell finds the directory ./man and tries to open this as the shell 
script.

chanrossa(1) rcs-5.7$ cd /usr
chanrossa(1) /usr$ ls -ld man
/unix/h-i386-cygwin32/bin/ls: man: No such file or directory
chanrossa(1) /usr$ man diff3
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Note: man script gets invoked correctly since ./man directory does not exist 
here.

PATH setting is:

/USR/LOCAL/BIN:/UNIX/H-I386-CYGWIN32/BIN:.:/BIN:/d/PERL/BIN:/d/WIN95:/d/WIN95
/COMMAND:/DOS:/DEVEL/CAFE/BIN:/DEVEL/CAFE/JAVA/BIN

The odd thing is that even if bash was searching the path again for the 
subshell it should still find the /usr/local/bin/man script first, not the 
../man directory.

Richard
--
richardd AT cix DOT compulink DOT co DOT uk                http://www.inside-edge.co.uk/
Inside Edge Consultancy           Client/Server and Internet Applications
PGP key from:  pgp-public-keys AT keys DOT pgp DOT net  -or-  http://www.four11.com/

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019