I don't know why most of the code is there.
An abbreviated version would probably work too.
I've reduced the application down to this minimized version:
#!/bin/sh
# /etc/acpi/lidswitch.sh
# Re-activates the screen when the lid is opened again
LID_STATE="/proc/acpi/button/lid/LID/state"
VT_NR=/tmp/lid_sh
if grep -q open "$LID_STATE"; then
vbetool dpms on
chvt `cat $VT_NR`
rm -f "$VT_NR"
else
fgconsole > $VT_NR
fi
This document is strictly confidential and intended only for use by the addressee unless
otherwise stated. If you are not the intended recipient, please notify the sender
immediately and delete it from your system.