Mail Archives: cygwin/2004/03/23/13:54:48
------=_NextPart_000_0003_01C41110.41402BD0
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
> From: Dave Korn
> > From: cygwin-owner On Behalf Of Christopher M. Balz
> > Sent: 23 March 2004 06:39
> > Apparently however, from your comments, it looks as if the
> > MKS system makes breaks the Cygwin installation. Is there a
> > way (or a place I could look to find out) where I could
> > protect the path that Cygwin uses?
> >
> > Thank you so much for your help.
> >
> > - Chris
>
> Simplest thing to do I reckon is to put something in either your
> cygwin.bat or your .bashrc / .profile to reset $PATH to something safe,
> depending on how you most commonly start up cygwin.
>
> cheers,
> DaveK
The attached script might come in handy; as defined it removes lines that
matches
sd="/bc"
grep -v -i "$sd"
(check the script and locate the lines), delivered to all of you "as is",
no warranties implied... It is probably possible to enhance it: I haven't
bothered to do that, yet.
I use it to remove certain elements of $PATH that _MIGHT_ be in there when I
launch cygwin/bash. Use: "source <script>" is in my ~/.profile
/Hannu E K Nevalainen, B.Sc. EE - 59+16.37'N, 17+12.60'E
** on a mailing list; please keep replies on that particular list **
-- printf("LocalTime: UTC+%02d\n",(DST)? 2:1); --
--END OF MESSAGE--
------=_NextPart_000_0003_01C41110.41402BD0
Content-Type: application/octet-stream;
name=".rm_bc_paths"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename=".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=3D"/bc"
hd=3D".rm_bc_paths:"
#lets have a copy of the current PATH
echo $PATH >/tmp/PATH
#replace ':' with linefeeds
tr ':' '\n' </tmp/PATH >/tmp/PATHLF
#remove lines that contains $sd
grep -v -i "$sd" </tmp/PATHLF >/tmp/PATH_CLEANLF1
#remove lines referring to /cygdrive/c
grep -v -i "/cygdrive/c" </tmp/PATH_CLEANLF1 >/tmp/PATH_CLEANLF
#restore :'s as separator,
# could be done w 'tr', but more control is required
cat /tmp/PATH_CLEANLF | (=20
read d;=20
while [ ! -z "$d" ] ;do=20
echo -n "$d";=20
read d;=20
if [ ! -z "$d" ] ;then=20
echo -n ":";
fi;=20
done
) >/tmp/PATH_CLEAN
#set the new clean path
export PATH=3D`cat /tmp/PATH_CLEAN`
#inform user...
diff -u0p /tmp/PATHLF /tmp/PATH_CLEANLF >/tmp/PATH_REMOVED
if [ `wc -w </tmp/PATH_REMOVED` -gt 0 ]
then
echo "$hd --- Removed path(s) --- "
# cat /tmp/PATH_REMOVED
# echo "---"
sed </tmp/PATH_REMOVED -rne "s,^-([^-].*)$,${hd} \1,p"
echo "$hd --- end of list --- "
else
echo "$hd \"$sd\" not found. No action taken"
fi
#cleanup
rm /tmp/PATH*
unset sd
unset hd
------=_NextPart_000_0003_01C41110.41402BD0
Content-Type: text/plain; charset=us-ascii
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
------=_NextPart_000_0003_01C41110.41402BD0--
- Raw text -