#!/bin/bash mkdir -p /tmp/smartauthmon/ ls /var/run/xdmctl > /tmp/smartauthmon/originalxdm # Set loop separator to end of line BAKIFS=$IFS IFS=$(echo -en "\n\b") exec 3<&0 exec 0/dev/null`" == "0" ]; then echo "Found active display on $line" if [[ $newdisplayfound -eq 0 ]]; then tempnewdisplay=$((newdisplay + 1)) if [[ $line -eq $tempnewdisplay ]]; then echo "Sequential display $line found after display $newdisplay..." newdisplay=$line fi fi fi done exec 0<&3 newdisplay=$(($newdisplay + 1)) rm -rf /tmp/smartauthmon/