Refactor screen + mail check output.

This commit is contained in:
Darren 'Tadgy' Austin 2016-10-07 19:02:19 +01:00
commit b11015d097

View file

@ -74,16 +74,16 @@ hash ssh-add ssh-agent >/dev/null 2>&1 && {
hash screen >/dev/null 2>&1 && { hash screen >/dev/null 2>&1 && {
if [ ! -e ~/.hushlogin ]; then if [ ! -e ~/.hushlogin ]; then
if [ ! -z "$STY" ]; then if [ ! -z "$STY" ]; then
echo
echo "Screen $STY, window $WINDOW." echo "Screen $STY, window $WINDOW."
echo
else else
_SCREENS="$( screen -ls | grep '[[:alpha:]]' | egrep -v '^([[:digit:]]+|No) Socket(s)?' )" _SCREENS="$( screen -ls | grep '[[:alpha:]]' | egrep -v '^([[:digit:]]+|No) Socket(s)?' )"
if [ -n "$_SCREENS" ]; then if [ -n "$_SCREENS" ]; then
echo
echo "$_SCREENS" echo "$_SCREENS"
else
echo echo
else
echo "No screens." echo "No screens."
echo
fi fi
unset _SCREENS unset _SCREENS
fi fi
@ -94,16 +94,14 @@ hash screen >/dev/null 2>&1 && {
[ ! -z "$SSH_CONNECTION" ] && { [ ! -z "$SSH_CONNECTION" ] && {
if [ -s /var/spool/mail/$USER ]; then if [ -s /var/spool/mail/$USER ]; then
if [ -N /var/spool/mail/$USER ]; then if [ -N /var/spool/mail/$USER ]; then
echo
echo "You have new mail." echo "You have new mail."
else
echo echo
else
echo "You have mail." echo "You have mail."
echo
fi fi
# else # else
# echo
# echo "No mail." # echo "No mail."
# echo
fi fi
} }
echo