This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

DOS <-> Bash interaction...


NOTE: Running Win98SE
Don't know how this affects Win<Other>

on 2002-12-25 at 13:37 i wrote about a problem with $SHELL versus 'startx'
i.e: startx won't work if $SHELL contains 'command.com' (or any DOS-stuff
maybe?). The contents of DOS-$SHELL gets copied into bash-$SHELL -> not
good.

There is another similar problem that might be hard to cope with too:

 As one starts bash it apparently:
	- copies the DOS/WIN - "$PATH" contents,
	- puts them in bash-$PATH and then
	- appends any new stuff

 I'm not sure this behaviour is 'good'. Cause:
	1. there is a 'find.exe' in C:\windows\command\
	   bash should have problems locating '/usr/bin/find'
	2. If you have almost any compiler installed there
	   will be a 'cpp' and 'make' in one of them' paths.

This is reflected by, e.g: $ cygcheck -s -v -r
...
Found: c:\PROGRAM\BC31_DOS\BIN\cpp.exe
Warning: C:\Program\cygwin\bin\cpp.exe hides c:\PROGRAM\BC31_DOS\BIN\cpp.exe
Found: c:\PROGRAM\BC5\BIN\cpp.exe
Warning: C:\Program\cygwin\bin\cpp.exe hides c:\PROGRAM\BC5\BIN\cpp.exe
Found: C:\Program\cygwin\bin\find.exe
Found: c:\WINDOWS\COMMAND\find.exe
Warning: C:\Program\cygwin\bin\find.exe hides c:\WINDOWS\COMMAND\find.exe
...
Found: C:\Program\cygwin\bin\make.exe
Found: c:\PROGRAM\BC31_DOS\BIN\make.exe
Warning: C:\Program\cygwin\bin\make.exe hides
c:\PROGRAM\BC31_DOS\BIN\make.exe
Found: c:\PROGRAM\BC5\BIN\make.exe
Warning: C:\Program\cygwin\bin\make.exe hides c:\PROGRAM\BC5\BIN\make.exe
...

Suggested remedy:
 a) make the DOS-PATH contents appear (or be searched) LAST in bash-PATH
 b) DON'T copy DOS-PATH contents at all
 c) Have DOS-PATH appear as MSDOSPATH in bash, have bash use it.

 d) temporary solution below (add "source ~/.rm_bc_paths" to ~/.profile)
    NOTE1: simple commented script to make the *problem* clear.
    NOTE2: The script contains MY PERSONAL installation paths (not the
defaults)

/Hannu E K Nevalainen, Mariefred, Sweden



-- 8< --- ~/.rm_bc_paths ---
#NOTE: You MUST 'source' this.
#DON'T: !/bin/bash

#This is to remove the Borland compiler paths from PATH
#Install paths can be something like:
#
#	c:\PROGRAM\BC31_DOS\BIN
#	c:\PROGRAM\BC5\BIN
#
# which will contain / instead of \ in bash.
#
#grep PATTERN to look for (and remove)
sd="/bc"


#lets have a copy of the current PATH
echo $PATH 				>/tmp/PATH

#replace :'s with linefeeds
tr ':' '\n' 			</tmp/PATH	>/tmp/PATHLF

#remove lines that contains $sd
grep -v -i "$sd"			</tmp/PATHLF >/tmp/PATH_CLEANLF

#restore : as separator
tr '\n' ':' 			</tmp/PATH_CLEANLF >/tmp/PATH_CLEAN

#set the new clean path
export PATH=`cat /tmp/PATH_CLEAN`

#inform user...
echo "~/.rm_bc_paths: --- Removed these paths --- "
diff /tmp/PATHLF /tmp/PATH_CLEANLF

#cleanup
rm /tmp/PATH*
sd=

-- 8< --


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]