Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

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>

authored by

Anders Kaseorg and committed by
Raphael Megzari
d8ef13fc d44b6ae6

+6 -6
+6 -6
nixos/modules/programs/command-not-found/command-not-found.nix
··· 49 49 '' 50 50 # This function is called whenever a command is not found. 51 51 command_not_found_handle() { 52 - local p=${commandNotFound}/bin/command-not-found 53 - if [ -x $p -a -f ${cfg.dbPath} ]; then 52 + local p='${commandNotFound}/bin/command-not-found' 53 + if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then 54 54 # Run the helper program. 55 - $p "$@" 55 + "$p" "$@" 56 56 # Retry the command if we just installed it. 57 57 if [ $? = 126 ]; then 58 58 "$@" ··· 70 70 '' 71 71 # This function is called whenever a command is not found. 72 72 command_not_found_handler() { 73 - local p=${commandNotFound}/bin/command-not-found 74 - if [ -x $p -a -f ${cfg.dbPath} ]; then 73 + local p='${commandNotFound}/bin/command-not-found' 74 + if [ -x "$p" ] && [ -f '${cfg.dbPath}' ]; then 75 75 # Run the helper program. 76 - $p "$@" 76 + "$p" "$@" 77 77 78 78 # Retry the command if we just installed it. 79 79 if [ $? = 126 ]; then