1

I have the following script to execute "xset led" command on keypress but I cannot make it work for the command does not actually execute. Here is the script:

#!/bin/bash
res=$(echo "$(xset q)" | tr ";" "Scroll Lock")
if [[ $res == *"Scroll Lock: on"* ]]; then
    echo $(xset led on)
else
    echo $(xset led off)
fi

However when I execute echo $(xset led on) in the shell it works. Executing the script above outputs an empty line, though.

Burgi
  • 6,768

1 Answers1

0

The problem was actually in executing the wrong command in the if-else statement. When the backlight is on I executed xset led on instead of off. A rookie mistake was