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>
This commit is contained in:
Anders Kaseorg 2021-09-04 15:32:08 -07:00 committed by Raphael Megzari
parent d44b6ae6cb
commit d8ef13fc13

View File

@ -49,10 +49,10 @@ in
''
# 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
local p='${commandNotFound}/bin/command-not-found'
if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then
# Run the helper program.
$p "$@"
"$p" "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then
"$@"
@ -70,10 +70,10 @@ in
''
# 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
local p='${commandNotFound}/bin/command-not-found'
if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then
# Run the helper program.
$p "$@"
"$p" "$@"
# Retry the command if we just installed it.
if [ $? = 126 ]; then