#!/bin/bash unplugged=1 while [ $unplugged == 1 ]; do pamusb-check --quiet USERNAME if [ $? == 0 ]; then unplugged=2 sleep 1 killall startup_showimage kill `pidof fbi` sed -i "s/\(^AutomaticLoginEnable=\).*/AutomaticLoginEnable=true/" /etc/gdm/custom.conf /etc/rc.d/gdm start & sleep 5 sed -i "s/\(^AutomaticLoginEnable=\).*/AutomaticLoginEnable=false/" /etc/gdm/custom.conf else sleep 2 fi done;