help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "source" shell commands


From: Peter Dyballa
Subject: Re: "source" shell commands
Date: Sun, 25 Mar 2007 13:53:27 +0200


Am 25.03.2007 um 12:55 schrieb Matthew Flaschen:

Apparently bash.  However, ~/.bashrc already sources ~/.rc , which
includes JAVA_HOME .  It was my impression that bash *always* read
~/.bashrc .

As I recommended: put an

echo " Hi, Matt! It's me, your ~/.bashrc. Remember me, still?" > / dev/console

into your ~/.bashrc and see what you'll see.


What is pstree showing? For me, on Mac OS X, and launched from some menu, I get:

        pete 123 /\ pstree -p $$
        -+= 00001 root /sbin/launchd -v
\-+- 01695 pete -bin/tcsh -i -c /usr/local/bin/emacs-23.0.0 - geometry 100x57+666+44
           \-+- 01700 pete /usr/local/bin/emacs-23.0.0 -geometry 100x57+666+44
             \-+= 01701 pete -bin/tcsh -i
               \-+= 04001 pete pstree -p 1701
                 \--- 04002 root ps -axwwo user

An interactive tcsh stands at my beginning.


'Man bash,' in GNU Emacs, will reveal:

• when invoked as a login shell, it will read /etc/profile, ~/.bash_profile, ~/.bash_login, ~/.profile in that sequence;

• when invoked as an interactive shell, that is no login shell, it will read ~/.bashrc;

• when invoked with the name sh, it mimics the Bourne shell reading / etc/profile and ~/.profile, in that order;

        • when a login shell is finished, ~/.bash_logout is read.

There are constraints with environment variables like ENV or BASH_ENV. So even a non-interactive non-login bash can read (and execute) some RC files.

When the login bash hits the first of the many personal RC files, it only executes the first one. So, IMO, it's best to put everything personal in Bourne shell syntax into ~/.profile, which a Bourne shell or Bourne shell bash will read (and execute) also.

And read, not entirely, you have C-s, the *Man bash* buffer a few times!


Should I source ~/.rc in ~/.profile instead?

No. Keep it simple, let bash do its job right.

--
Greetings

  Pete

Math illiteracy affects 7 out of every 5 Americans.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]