View Single Post
  #2   (View Single Post)  
Old 1st December 2022
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
Bitchy Nerd Elitist
 
Join Date: Dec 2015
Location: London
Posts: 467
Default

The script has a /bin/sh shebang but the [[ test construct is undefined in POSIX.

I would use $(...) instead of backticks and also awk instead of grep & cut so:
Code:
#!/bin/sh

tp_state=$(doas wsconsctl 2>/dev/null | awk -F'=' '/mouse.tp.disable/{print $2}')

if [ "$tp_state" -eq 0 ] ; then
   doas wsconsctl mouse.tp.disable=1 1>/dev/null
else
   doas wsconsctl mouse.tp.disable=0 1>/dev/null
fi
Not sure why you've used backticks around the then & else commands but perhaps I've missed something there.

Last edited by Head_on_a_Stick; 1st December 2022 at 05:55 PM.
Reply With Quote