comparison .zshrc @ 505:b78aa03c0c00

zshrc: silence noisy which(1) implementations Some of them like to write to stdout, fun.
author Augie Fackler <raf@durin42.com>
date Sat, 21 Nov 2020 21:02:02 -0500
parents a7f5b0526a51
children 852565046ed0
comparison
equal deleted inserted replaced
504:1b863525992d 505:b78aa03c0c00
7 # Login greeting ------------------ 7 # Login greeting ------------------
8 8
9 if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then 9 if [ ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then
10 # Use /bin/which explicitly because we have a shell function 10 # Use /bin/which explicitly because we have a shell function
11 # that confuses the zsh built-in which. 11 # that confuses the zsh built-in which.
12 if sh -c 'which screen' > /dev/null; then 12 if sh -c 'which screen' 2> /dev/null > /dev/null; then
13 detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'` 13 detached_screens=`screen -list | grep Detached | sed -e 's/ (Detached)//'`
14 if [ ! -z "$detached_screens" ]; then 14 if [ ! -z "$detached_screens" ]; then
15 echo "+---------------------------------------+" 15 echo "+---------------------------------------+"
16 echo "| Detached screens are available: |" 16 echo "| Detached screens are available: |"
17 echo "$detached_screens" 17 echo "$detached_screens"
20 fi 20 fi
21 export SHOWED_SCREEN_MESSAGE="true" 21 export SHOWED_SCREEN_MESSAGE="true"
22 fi 22 fi
23 23
24 if [ ! "$SHOWED_TMUX_MESSAGE" = "true" ]; then 24 if [ ! "$SHOWED_TMUX_MESSAGE" = "true" ]; then
25 if which tmux > /dev/null; then 25 if which tmux 2> /dev/null > /dev/null; then
26 detached_screens=$(tmux ls 2> /dev/null | grep -v attached) 26 detached_screens=$(tmux ls 2> /dev/null | grep -v attached)
27 if [ ! -z "$detached_screens" ]; then 27 if [ ! -z "$detached_screens" ]; then
28 echo "+-----------------------------------------------------------+" 28 echo "+-----------------------------------------------------------+"
29 echo "| Detached tmux sessions are available: |" 29 echo "| Detached tmux sessions are available: |"
30 echo "$detached_screens" 30 echo "$detached_screens"