#!/usr/bin/env sh case $1 in "enable") ACTION="enable" ;; "disable") ACTION="disable" ;; *) echo "Invalid action." echo "Usage: $0 enable|disable" exit ;; esac DEVICES=$(xinput list --name-only | grep -i touchpad) if [ -z "$DEVICES" ]; then echo "No touchpad found." exit fi IFS=' ' for DEVICE in $DEVICES; do xinput "$ACTION" "$DEVICE" done