0
#!/bin/bash
var1="r on"
var2="r off"
xset=$xset
if [[ $(xset r on) = true ]] then
  $xset "$var1"
 else
  $xset "$var2"
fi

is the script which I tried to run to toggle the key repeat.

When running the script, the key repeat is kept on/off.

Apologies in advance if I sound like a newbie. I'm really new to this scripting stuff.

Edit: I tried running the script in a terminal, but the output was:

Toggle key repeat.sh: 5: Toggle key repeat.sh: [[: not found
Toggle key repeat.sh: 9: Toggle key repeat.sh: r off: not found
Psionikal
  • 274

1 Answers1

2

You want to do something like this:

#!/bin/bash

if [[ $(xset q) =~ 'auto repeat:  on' ]]
then
    xset r off
else
    xset r on
fi