 <p>Presumably something like this:</p> <pre><code>#!/bin/bash class=org.gnome.settings-daemon.peripherals.touchpad name=tap-to-click status=$(gsettings get "$class" "$name") status=${status,,} # normalize to lower case; this is a modern bash extension if [[ $status = true ]]; then new_status=false else new_status=true fi gsettings set "$class" "$name" "$new_status" </code></pre> <p>Breaking it down into pieces:</p> <ul> <li><code>#!/bin/bash</code> ensures that the interpreter for this script is bash, enabling extended syntax such as <code>[[ ]]</code>.</li> <li>The syntax <code>$( )</code> is "command substitution"; this runs a command, and substitutes the output of that command. Thus, if the output is <code>true</code>, then <code>status=$(...)</code> becomes <code>status=true</code>.</li> <li>The parameter expansion <code>${name,,}</code> expands the contents of <code>name</code> while converting those contents to all-lowercase, and is only available in newer versions of bash. If you want to support <code>/bin/sh</code> or older releases of bash, consider <code>status=$(printf '%s\n' "$status" | tr '[:upper:]' '[:lower:]')</code> instead, or just remove this line if the output of <code>gsettings get</code> is always lowercase anyhow.</li> <li>The comparison <code>[[ $status = true ]]</code> relies on the bash extension <code>[[ ]]</code> (also available in other modern ksh-derived shells) to avoid the need for quoting. If you wanted it to work with <code>#!/bin/sh</code>, you'd use <code>[ "$status" = true ]</code> instead. (Note that <code>==</code> is allowable inside <code>[[ ]]</code>, but is <strong>not</strong> allowable inside of <code>[ ]</code> on pure POSIX shells; this is why it's best not to be in the habit of using it).</li> </ul> <p>Note that whitespace is important in bash! <code>foo = bar</code>, <code>foo= bar</code> and <code>foo=bar</code> are completely different statements, and all three of them do different things from the other two. Be sure to be cognizant of the differences in copying from this example.</p>