linuxbashshellgnu-screen

Checking any screen session active on linux


I'm trying discover if any linux screen session is running. Currently, I have the code for only a specific screen by name, but I want discover if any screen session is running. Can you help me?

screen -list | grep "SESSİON NAME" && echo "Active Program" || echo "Passive Program"

How can I update this code above to match all screens running?


Solution

  • Just grep for the proper string:

    if screen -list | grep "No active:"; then echo "No active Program"; else echo "There is an active Program"; fi