This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Re: How to make cygwin/bash shell work in emacs
- To: radar at cacheware dot com
- Subject: Re: How to make cygwin/bash shell work in emacs
- From: "Ehud Karni" <ehud at unix dot simonwiesel dot co dot il>
- Date: Wed, 3 Oct 2001 11:28:27 +0200
- CC: chet at po dot CWRU dot Edu, cygwin at cygwin dot com
- Organization: Mivtach-Simon Insurance agencies
- References: <NMEHIGJBPAKOAODKKENBOEGHCDAA.radar@cacheware.com>
- Reply-to: ehud at unix dot simonwiesel dot co dot il
On Tue, 2 Oct 2001 18:17:41 -0700, Roman Adar <radar@cacheware.com> wrote:
>
> I've tried the approach with the ".bashrc" file, but it creates other
> problems. When I've the "set -x" still set for tracing I can see that it
> loads the "shell" FOREVER, repeatedly. It never exits the load... statement.
That is because of the last lines in your /etc/profile:
cd "$HOME"
test -f ./.bashrc && . ./.bashrc
which just runs your ~/.bashrc again.
There are several ways to overcome this.
1. You can put the relevant code in ~/.bashrc and not /etc/profile
I don't recommend this solution.
2. You can set a local (not env) variable that indicate /etc/profile
has been processed (full example below).
3. The recommended solution - put the common code in a separate file
and source it whenever it is needed.
>
> It looks like the ".bashrc" file is the solution, but I also probably, need
> to make some changes in my ".emacs" and the "/etc/profile" files. However
> I'm not sure where and what.
You don't need to change ".emacs" as for "/etc/profile" - please
do (3) above.
> I believe that at this point I'll invoke the perl explicitly with the full
> path when I use it in the emacs sub-shell.
You can do that, but it is not convenient, and you are just few lines
from a really GOOD solution.
Annex: how to call /etc/profile from ~/.bashrc and ~/.bashrc from
/etc/profile without a loop.
1. Add to /etc/profile (near its beginning) ETC_PROFILE=ON
DO NOT export it ! The reason for not exporting is that you
to run /etc/profile + ~/.bashrc for sub processes.
2. Build the ~/.bashrc like this:
if [ "$ETC_PROFILE" != ON ] ; then
source /etc/profile
else
<real bashrc code>
fi
I added the annex because SOMETIMES it is useful, but please use option
(3) above whenever possible.
Ehud.
--
Ehud Karni Mivtach - Simon Insurance /"\
Tel: +972-3-7966-561 Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
(USA) Fax and voice mail: 1-815-5509341 X Against HTML Mail
Better Safe Than Sorry / \
mailto:ehud@unix.simonwiesel.co.il http://www.simonwiesel.co.il
--
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/