public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Michael A. Chase" <mchase@ix.netcom.com>
To: "Sergey Okhapkin" <sos@prospect.com.ru>, <gnu-win32@cygnus.com>,
	"'Andy Piper'" <andyp@parallax.co.uk>
Subject: Bash Environment (Was: Bash history?)
Date: Tue, 16 Sep 1997 06:16:00 -0000	[thread overview]
Message-ID: <199709161314.IAA17515@dfw-ix7.ix.netcom.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1347 bytes --]

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@prospect.com.ru>
To: gnu-win32@cygnus.com <gnu-win32@cygnus.com>; 'Andy Piper'
<andyp@parallax.co.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


[-- Attachment #2: profile --]
[-- Type: text/plain, Size: 1102 bytes --]


if [ ${_ETC_PROFILE_:=0} = 0 ]; then
   export _ETC_PROFILE_=1

   if [ $(env | grep ';' | wc -c) -ne 0 ]; then
      echo "Fixing env"
      # Add 'UNIX' executable directories and remove windows ones
      PATH="/usr/local/bin:/bin:/usr/bin:/bin:$PATH"
      PATH=`echo "$PATH" | sed -e 's,:/perl5.004.bc/bin,,;s,:/wbin,,g'`

      # Convert DOS backslashes, drives, and path separators in environment to UNIX
      # 1. Don't touch PATH
      # 2. Don't lines starting with punctuation !_@#%^&*()=+:;<>?/`~-
      # 3. Backslash -> slash
      # 4. C:/ -> / and C:  -> /
      # 5. DRIVE: -> /DRIVE
      # 6. ; -> :
      # 7. Quote values

      tfile=/tmp/profile.$$
      env | \
         sed -e '/^$/d;/^PATH=/d' \
             -e '/^[!_@#%^&*()=+:;<>?/`~-]/d' \
             -e 's,\\,/,g' \
             -e 's,[Cc]:/,/,g' -e 's,[Cc]:,/,g' \
             -e 's,\([a-zA-Z]\):,//\1/,g' \
             -e 's,;,:,g' \
             -e "s/^\([^=][^=]*=\)\(.*\)$/\1'\2'/" > $tfile
      source $tfile
      rm $tfile
   fi

   # Other shell initialization stuff
   export TERM=linux
   set -o vi
fi


             reply	other threads:[~1997-09-16  6:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-09-16  6:16 Michael A. Chase [this message]
1997-09-16 21:51 Wei Ku
1997-09-18  6:23 Michael A. Chase
1997-09-19  6:52 Michael A. Chase

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199709161314.IAA17515@dfw-ix7.ix.netcom.com \
    --to=mchase@ix.netcom.com \
    --cc=andyp@parallax.co.uk \
    --cc=gnu-win32@cygnus.com \
    --cc=sos@prospect.com.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).