#!/bin/bash if [ -c /dev/input/js* ]; # -c is a character device - see http://tldp.org/LDP/abs/html/fto.html for option then setfacl -m g:gamepad:rw- /dev/input/js* #for ACL see https://help.ubuntu.com/community/FilePermissionsACLs echo "Gamepad ACL permission set" else echo "No gamepad detected, ACL not set" fi