Ok so I made the following script:
#!/bin/sh
if ! ps -C screen > /dev/null
then
exec xterm -fg green -bg black -e screen
else
if ps -C xterm > /dev/null
then
exec xterm -fg green -bg black -e screen
else
exec xterm -fg green -bg black -e screen -r
fi
fi
This script is run whenever I open a terminal. The problem is that on line 11 and error occurs if there are multiple screen sessions unattached screen sessions. Is there anyway to determine the pid of a
process?