#!/bin/bash ID="$(id|awk '{print $1}'|cut -d"=" -f2|cut -b -4)" RUNNING="$(ps aux|egrep "irssi"|egrep "^${ID}"|head -n 1)" if [[ "$(echo "${RUNNING}"|awk '{print $11}')" == "SCREEN" ]] then screen -x else bash fi