Recently I've discovered how useful
The following code works perfectly, but am I handling it the right way - and in the correct file?
I've added this code to the end of ~/.bash_profile :
Now it will show this at login if any screens are active:
screen
is. However after detaching from sessions, I keep forgetting about them. To solve that issue, I would like to display any active sessions after login.The following code works perfectly, but am I handling it the right way - and in the correct file?
I've added this code to the end of ~/.bash_profile :
Code:
# Display if any screens are running after login
if [ "$TERM" != "screen" ]; then
SCNS=$(screen -ls | awk '/[.]pts-/ {print $1}')
if [ ! -z "$SCNS" ]; then
echo "There are screens running on:" && echo "$SCNS" && echo ""
fi
fi
Now it will show this at login if any screens are active:
Code:
FreeBSD 11.1-RELEASE-p4 (GENERIC) #0: Tue Nov 14 06:12:40 UTC 2017
Welcome to FreeBSD!
There are screens running on:
28921.pts-0.localhost
[name@localhost ~]$