annotate .bashrc @ 526:852565046ed0 default tip

zsh: fidget with screen/tmux message This should speed things up very slightly by avoiding some `grep` action in the common case of no detached screens/tmuxes.
author Augie Fackler <raf@durin42.com>
date Mon, 14 Nov 2022 11:02:35 -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