Disabling the Laptop TouchPad in Linux

If you have attached an external mouse to your laptop, you may not need touchpad which may be accidentally touch. I’ve made a short script to disable and enable the touchpad.
1: Disabling the TouchPad

#!/bin/sh
dev=`xinput --list | grep PS/2 | grep Generic | cut -f2-2 | cut -c 4-10`
export DISPLAY=:0
xinput set-int-prop $dev "Device Enabled" 8 0
echo "Device id=$dev has been disabled"

2: Enabling the TouchPad

#!/bin/sh
dev=`xinput --list | grep PS/2 | grep Generic | cut -f2-2 | cut -c 4-10`
export DISPLAY=:0
xinput set-int-prop $dev "Device Enabled" 8 1
echo "Device id=$dev has been enabled"