annotate .bashrc @ 377:117e3c11d953

zprofile: introduce zprofile use El Capitan (OS X 10.11) introduces a system-level /etc/zprofile which uses a path_helper thing to mangle $PATH. Unfortunately, the way path_helper works, it forces /usr/local/bin and /usr/bin to the *start* of the PATH variable, which means that any PATH mutations I want have to run after /etc/zprofile calls path_helper. As such, move my path insertions into .zprofile{,-machine} rather than .zshenv{,-machine} so that I can still ensure my path entries are at the start of PATH rather than the end. This works because: > Commands are then read from $ZDOTDIR/.zshenv. If the shell is a > login shell, commands are read from /etc/zprofile and then > $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands > are read from /etc/zshrc and then $ZDOTDIR/.zshrc. Finally, if the > shell is a login shell, /etc/zlogin and $ZDOTDIR/.zlogin are read. This means that non-login shells no longer pick up my custom PATH entries, but as I only use OS X as a desktop OS that seems like a workable tradeoff for now.
author Augie Fackler <raf@durin42.com>
date Sun, 31 Jan 2016 20:46:29 -0500
parents 6a781c14cdfd
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
39
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
1 # This is more or less a clone of my .zshrc, with modifications as needed.
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
2 # The .zshrc is canonical, bash is simply the home-away-from-home when needed.
0
c30d68fbd368 Initial import from svn.
Augie Fackler <durin42@gmail.com>
parents:
diff changeset
3
39
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
4 # one-off alias for a zsh reflex
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
5 alias ..='cd ..'
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
6
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
7 for file in $(ls $HOME/.shell.d/*.{,ba}sh) ; do
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
8 source $file
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
9 done
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
10
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
11 if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
12 if which screen > /dev/null; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
13 detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'`
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
14 if [ ! -z "$detached_screens" ]; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
15 echo "+---------------------------------------+"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
16 echo "| Detached screens are available: |"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
17 echo "$detached_screens"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
18 echo "+---------------------------------------+"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
19 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
20 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
21 export SHOWED_SCREEN_MESSAGE="true"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
22 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
23
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
24 # If available, source private extensions stored in a different repo
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
25 if [[ -a ~/.private/bashrc ]]; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
26 source ~/.private/bashrc
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
27 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
28
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
29 # I really wish bash had something like .zshenv - maybe I just don't know what it is called?
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
30 if [[ "x$TZ" == "x" ]] ; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
31 export MACHINE_TZ="xNoTimeZone"
163
6a781c14cdfd zsh/bash: change default timezome
Augie Fackler <durin42@gmail.com>
parents: 42
diff changeset
32 DEFAULT_TZ="America/Chicago"
39
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
33 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
34
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
35 # Do this right before the timezone stuff
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
36 if [[ -a ~/.bashrc-machine ]]; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
37 source ~/.bashrc-machine
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
38 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
39
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
40 # do this last so that we can tell if .zshenv-machine set the timezone
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
41 if [[ "x$TZ" == "x" ]] ; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
42 if [ "$MACHINE_TZ" = "xNoTimeZone" ]; then
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
43 export TZ="$DEFAULT_TZ"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
44 else
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
45 export TZ="$MACHINE_TZ"
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
46 fi
62bfb554ab85 Reorganize zsh files so that bash can work as well.
Augie Fackler <durin42@gmail.com>
parents: 5
diff changeset
47 fi