modules/programs/command-not-found: Fix ShellCheck warnings

https://github.com/koalaman/shellcheck/wiki/SC2086
Double quote to prevent globbing and word splitting.

https://github.com/koalaman/shellcheck/wiki/SC2166
Prefer `[ p ] && [ q ]` as `[ p -a q ]` is not well defined.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>

Changed files
+6 -6
nixos
modules
programs
command-not-found
+6 -6
nixos/modules/programs/command-not-found/command-not-found.nix
···
''
# This function is called whenever a command is not found.
command_not_found_handle() {
-
local p=${commandNotFound}/bin/command-not-found
-
if [ -x $p -a -f ${cfg.dbPath} ]; then
# Run the helper program.
-
$p "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then
"$@"
···
''
# This function is called whenever a command is not found.
command_not_found_handler() {
-
local p=${commandNotFound}/bin/command-not-found
-
if [ -x $p -a -f ${cfg.dbPath} ]; then
# Run the helper program.
-
$p "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then
···
''
# This function is called whenever a command is not found.
command_not_found_handle() {
+
local p='${commandNotFound}/bin/command-not-found'
+
if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then
# Run the helper program.
+
"$p" "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then
"$@"
···
''
# This function is called whenever a command is not found.
command_not_found_handler() {
+
local p='${commandNotFound}/bin/command-not-found'
+
if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then
# Run the helper program.
+
"$p" "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then