#!/bin/sh doIt() { if xrandr | grep 'HDMI-A-0' | grep connected >/dev/null; then xrandr --output HDMI-A-0 --set TearFree "$1" else xrandr --output eDP --set TearFree "on" fi } case "$1" in "on") doIt "on" ;; "off") doIt "off" ;; *) echo "That option doesn't exist" ;; esac