delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/09/16/06:45:10

From: mchase AT ix DOT netcom DOT com (Michael A. Chase)
Subject: Bash Environment (Was: Bash history?)
16 Sep 1997 06:45:10 -0700 :
Message-ID: <199709161314.IAA17515.cygnus.gnu-win32@dfw-ix7.ix.netcom.com>
Mime-Version: 1.0
To: "Sergey Okhapkin" <sos AT prospect DOT com DOT ru>, <gnu-win32 AT cygnus DOT com>,
"'Andy Piper'" <andyp AT parallax DOT co DOT uk>

This is a multi-part message in MIME format.

------=_NextPart_000_0000_01BCC207.94C661C0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

I have similar problems.  It appears that the only environment variable
that gets changed from MSDOS form to UNIX form is $PATH.  All the others
keep their backslashes and semicolons.

I put code in /etc/profile to fix the environment (attached).
Unfortunately, I have never seen /etc/profile run by default so I added a
check for it to .bashrc (which does work) to run both /etc/profile and
..bash_profile.

Is there something else I should be doing to get the correct environment
at bash startup?

Mac :})
-----Original Message-----
From: Sergey Okhapkin <sos AT prospect DOT com DOT ru>
To: gnu-win32 AT cygnus DOT com <gnu-win32 AT cygnus DOT com>; 'Andy Piper'
<andyp AT parallax DOT co DOT uk>
Date: Sunday, September 07, 1997 22:02
Subject: RE: Bash history?



>Andy Piper wrote:
>> 1) ~ seems to be interpreted wrongly. If I do `cd ~' I get:
>> bash.exe: C:WINNTProfilesandyp: No such file or directory
>> cd $HOME works fine. Somehow the /'s are getting stripped out.
>
>I'm sure, there are backslashes instead of slashes in your HOME env.
var. Set HOME to
>c:/WINNT/Profiles/andyp.
>
>>
>> 2) History is not preserved between sessions. Although bash
>> writes out a history file - .bash_history - correctly. It is not read
when
>
>Fix the first problem, and the second one should came out.
>
>--
>Sergey Okhapkin, http://www.lexa.ru/sos
>Moscow, Russia
>Looking for a job


------=_NextPart_000_0000_01BCC207.94C661C0
Content-Type: application/octet-stream;
	name="profile"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
	filename="profile"

=0A=
if [ ${_ETC_PROFILE_:=3D0} =3D 0 ]; then=0A=
   export _ETC_PROFILE_=3D1=0A=
=0A=
   if [ $(env | grep ';' | wc -c) -ne 0 ]; then=0A=
      echo "Fixing env"=0A=
      # Add 'UNIX' executable directories and remove windows ones=0A=
      PATH=3D"/usr/local/bin:/bin:/usr/bin:/bin:$PATH"=0A=
      PATH=3D`echo "$PATH" | sed -e 's,:/perl5.004.bc/bin,,;s,:/wbin,,g'`=0A=
=0A=
      # Convert DOS backslashes, drives, and path separators in =
environment to UNIX=0A=
      # 1. Don't touch PATH=0A=
      # 2. Don't lines starting with punctuation !_@#%^&*()=3D+:;<>?/`~-=0A=
      # 3. Backslash -> slash=0A=
      # 4. C:/ -> / and C:  -> /=0A=
      # 5. DRIVE: -> /DRIVE=0A=
      # 6. ; -> :=0A=
      # 7. Quote values=0A=
=0A=
      tfile=3D/tmp/profile.$$=0A=
      env | \=0A=
         sed -e '/^$/d;/^PATH=3D/d' \=0A=
             -e '/^[!_@#%^&*()=3D+:;<>?/`~-]/d' \=0A=
             -e 's,\\,/,g' \=0A=
             -e 's,[Cc]:/,/,g' -e 's,[Cc]:,/,g' \=0A=
             -e 's,\([a-zA-Z]\):,//\1/,g' \=0A=
             -e 's,;,:,g' \=0A=
             -e "s/^\([^=3D][^=3D]*=3D\)\(.*\)$/\1'\2'/" > $tfile=0A=
      source $tfile=0A=
      rm $tfile=0A=
   fi=0A=
=0A=
   # Other shell initialization stuff=0A=
   export TERM=3Dlinux=0A=
   set -o vi=0A=
fi=0A=
=0A=

------=_NextPart_000_0000_01BCC207.94C661C0--

-
For help on using this list (especially unsubscribing), 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