summaryrefslogtreecommitdiff
path: root/wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt
diff options
context:
space:
mode:
Diffstat (limited to 'wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt')
-rw-r--r--wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt b/wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt
new file mode 100644
index 0000000..8d418d2
--- /dev/null
+++ b/wired/old/published/Webmonkey/Monkey_Bites/2007/04.16.07/Tue/bash.txt
@@ -0,0 +1,19 @@
+I've long been confused as to whether I should put environment variable in my ~/.bash_profile or ~/.bashrc file. As it turns out I'm not the only one who can't keep these straight. Luckily for you and I, a blogger by the name of Josh Staiger is not so lazy he can't be bothered to type man bash.
+
+Staiger's post is almost two years old and I don't remember how I stumbled across it, but as with most things *nix there haven't been any major changes lately.
+
+Here's Staiger's explanation of the difference between the two files:
+
+>According to the bash man page, .bash_profile is executed for login shells, while .bashrc is executed for interactive non-login shells.
+
+>What I take this to mean is that when I login when using a console, either physically at the machine or using ssh, .bash_profile is executed.
+
+>However, if I launch a terminal within a windowing system such as KDE, launch the Emacs *shell* mode, or execute /bin/bash from within another terminal then .bashrc is executed.
+
+If keeping the two straight is just too much effort, Staiger points out that most people tend edit the files so one calls the other. That way you can keep all your variables in one place without having to keep track of which file is used by which shell type. To enact this sort of trickery you'll need to open .bash_profile and uncomment the following lines:
+
+ if [ -f ~/.bashrc ]; then
+ source ~/.bashrc
+ fi
+
+Those lines may not be there on some flavors of *nix, for instance they we're there on my OS X machine, but adding them in seems to work. Let me know if you have problems. \ No newline at end of file