Add gitattributesdb support. Update bash startup files. Small changes to other files.
This commit is contained in:
parent
e6fa97ecda
commit
93e8fe1e3f
22 changed files with 742 additions and 620 deletions
48
.bash_profile.d/screen
Executable file
48
.bash_profile.d/screen
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash - not strictly necessary, but helps nano with syntax highlighting.
|
||||
|
||||
hash screen >/dev/null 2>&1 && {
|
||||
[[ -e "$HOME/.screenrc-${HOSTNAME%%.*}" ]] && export SCREENRC="$HOME/.screenrc-${HOSTNAME%%.*}"
|
||||
export SCREENDIR="$HOME/.screen-${HOSTNAME%%.*}"
|
||||
if [[ -n "$SSH_TTY" ]]; then
|
||||
if [[ -n "$STY" ]]; then
|
||||
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
|
||||
else
|
||||
SCREENS="$(screen -ls | command grep '[[:alpha:]]' | command grep -E -v '^([[:digit:]]+|No) Socket(s)?')"
|
||||
if [[ -n "$SCREENS" ]]; then
|
||||
printf "%s\\n\\n" "$SCREENS"
|
||||
else
|
||||
printf "%s\\n\\n" "No screens."
|
||||
fi
|
||||
unset SCREENS
|
||||
fi
|
||||
elif [[ -n "$STY" ]]; then
|
||||
printf "%s\\n\\n" "Screen $STY, window $WINDOW."
|
||||
else
|
||||
TTY="$(tty | cut -d/ -f3-)"
|
||||
SCREENS="$(screen -ls | command grep -F "${HOSTNAME%%.*}" | command grep -F "${TTY//\//-}")"
|
||||
# This has to be an echo, not printf.
|
||||
case "$(echo "${SCREENS:--n}" | wc -l)" in
|
||||
0)
|
||||
# No screens found - start a new instance if on a tty.
|
||||
# Disabled this because screens should be started on chuckie not the desktop/laptop.
|
||||
# [[ "$TTY" == tty* ]] && screen
|
||||
:
|
||||
;;
|
||||
1)
|
||||
# Just one screen - reconnect if it's not dead.
|
||||
if (( $(printf "%s" "$SCREENS" | command grep -c -F 'Dead') == 1 )); then
|
||||
printf "%s:\\n" "Found dead screen for $TTY"
|
||||
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
|
||||
else
|
||||
screen -dr "${TTY//\//-}.${HOSTNAME%%.*}"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
# Multiple screens - output a list
|
||||
printf "%s:\\n" "Multiple screens found for $TTY"
|
||||
printf "%s\\n" "$SCREENS" | sed -e 's/^/ /g'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
unset SCREENS TTY
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue