Replies: 2 comments
-
If you don't mind sharing the snippet you have working, we can think about a place to put it. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I don't mind at all! I doubt that is good enough to put it somewhere, but I guess you can use it to get an idea. This is what I use: # Function: existsScreenSession
function existsScreenSession {
screenLs=`screen -ls | head -n 1 | tr -d '[:space:]'`
if [[ "$screenLs" == *: ]]
then
existsScreenFlag=0
else
existsScreenFlag=1
fi
return $existsScreenFlag
}
#
# Function insideScreenSession
function insideScreenSession {
if [ -z "$STY" ]
then
insideScreen=1
else
insideScreen=0
fi
return $insideScreen
}
#
# Function: getGNUScreenInfo
function getGNUScreenInfo {
gnuScreenInfo=""
if existsScreenSession
then
if insideScreenSession
then
gnuScreenInfo="Inside GNUScreen session: $STY"
else
nbSessions=$(( $(screen -ls | wc -l | tr -d ' ') - 2 ))
if [ $nbSessions -gt 0 ]
then
gnuScreenInfo="$nbSessions GNUScreen session(s) active"
fi
fi
fi
echo $gnuScreenInfo
} and I call it as: gnInfo='$( getGNUScreenInfo )' Then I add the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
How can one include GNUScreen info at the PS1? Specifically, I would like to know:
I have figured out how to do this in my own, not bash-it, PS1, but I want to transfer that to bash-it. Any help?
Beta Was this translation helpful? Give feedback.
All reactions