aboutsummaryrefslogtreecommitdiffstats
path: root/.gitignore
diff options
context:
space:
mode:
authorMathias Bynens <mathias@qiwi.be>2011-10-22 12:28:24 +0300
committerMathias Bynens <mathias@qiwi.be>2011-10-22 12:28:24 +0300
commit3d791926a65118c9119f1f0506e79351dff5dbb7 (patch)
tree32f3090f96df052a340f8874a1662ca89f7fc716 /.gitignore
parentfc439ad5942e64503459599baa874a914c3029cd (diff)
downloaddotfiles-3d791926a65118c9119f1f0506e79351dff5dbb7.tar.gz
dotfiles-3d791926a65118c9119f1f0506e79351dff5dbb7.tar.bz2
dotfiles-3d791926a65118c9119f1f0506e79351dff5dbb7.zip
Don’t source .bash_profile when PS1 is not set (for non-interactive shells).
Stolen from @janmoesen’s https://github.com/janmoesen/tilde/blob/master/.bashrc: # This might seem backwards when you look at the "Bash startup files" reference # <http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files> or # the "INVOCATION" section in the man page. However, my workflow typically is: # # * Open a terminal with four shells in tabs # * Edit code in Vim, and shell out using ":sh" # # The initial four shells are login shells, so they source ~/.bash_profile. # The shells spawned by Vim are not login shells, but they /are/ interactive. # They look for .bashrc, but not .bash_profile. Because they are interactive, # PS1 is set, so I know it is OK to run all the shell initialisation code. # # If I were to put the contents of ~/.bash_profile in ~/.bashrc and make the # former source the latter, I would have to wrap the entire contents of the # latter in a huge "if [ -n "$PS1" ]; then ... fi" block. That does not really # help readability, does it? # # The difference between a login shell and an interactive non-login shell is # moot for me, so I consider all interactive shells to be equal and wanting # the same treatment. # # If you're wondering what a non-interactive shell might be, i.e. when PS1 # might not be set, try this: # # ssh localhost 'echo "PS1: >$PS1<"' #
Diffstat (limited to '.gitignore')
0 files changed, 0 insertions, 0 deletions