2
\$\begingroup\$

I have a shell script to configure Synaptics touchpad settings at login.

Background

You configure the touchpad with the synclient command. Its usage is

synclient [-lV?] [var1=value1 [var2=value2] ...]

For example:

  • synclient PalmDetect=1 — to set a single setting
  • synclient PalmDetect=1 PalmMinZ=10 — to set multiple

I'm trying to use my script itself as a configuration file by playing around with heredocs and grep. The script greps out all comment lines (starting with #) and then passes everything in the heredoc as arguments to synclient. Is this code clean? How could I improve it?

Script

#!/bin/sh
# script to configure Synaptic touchpad settings
# This script treats itself as a configuration file.

<< END_OF_SETTINGS grep -v '^#' | xargs synclient

# Try to disable touchpad while typing
PalmDetect=1
PalmMinZ=100

# Allow three-finger middle button tap, click
TapButton3=2
ClickFinger3=2

END_OF_SETTINGS
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.