diff options
author | Anders Kaseorg <andersk@mit.edu> | 2021-09-04 15:31:07 -0700 |
---|---|---|
committer | Raphael Megzari <raphael@megzari.com> | 2021-09-06 08:49:34 +0900 |
commit | d44b6ae6cb4d262b7281896df6f79fba04b67837 (patch) | |
tree | d51ef7fb86963de4a581569366dd8dfc511eba9b | |
parent | 6b30660ee1ec79c8265eed1578ac228a9ce49ba3 (diff) | |
download | nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar.gz nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar.bz2 nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar.lz nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar.xz nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.tar.zst nixpkgs-d44b6ae6cb4d262b7281896df6f79fba04b67837.zip |
modules/programs/bash: 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. https://github.com/koalaman/shellcheck/wiki/SC2219 Instead of `let expr`, prefer `(( expr ))` . Signed-off-by: Anders Kaseorg <andersk@mit.edu>
-rw-r--r-- | nixos/modules/programs/bash/bash-completion.nix | 2 | ||||
-rw-r--r-- | nixos/modules/programs/bash/bash.nix | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/nixos/modules/programs/bash/bash-completion.nix b/nixos/modules/programs/bash/bash-completion.nix index f07b1b636ef..b8e5b1bfa33 100644 --- a/nixos/modules/programs/bash/bash-completion.nix +++ b/nixos/modules/programs/bash/bash-completion.nix @@ -26,7 +26,7 @@ in shopt -s nullglob for p in $NIX_PROFILES; do for m in "$p/etc/bash_completion.d/"*; do - . $m + . "$m" done done eval "$nullglobStatus" diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix index 908ab34b08d..7281126979e 100644 --- a/nixos/modules/programs/bash/bash.nix +++ b/nixos/modules/programs/bash/bash.nix @@ -78,10 +78,10 @@ in promptInit = mkOption { default = '' # Provide a nice prompt if the terminal supports it. - if [ "$TERM" != "dumb" -o -n "$INSIDE_EMACS" ]; then + if [ "$TERM" != "dumb" ] || [ -n "$INSIDE_EMACS" ]; then PROMPT_COLOR="1;31m" - let $UID && PROMPT_COLOR="1;32m" - if [ -n "$INSIDE_EMACS" -o "$TERM" == "eterm" -o "$TERM" == "eterm-color" ]; then + ((UID)) && PROMPT_COLOR="1;32m" + if [ -n "$INSIDE_EMACS" ] || [ "$TERM" = "eterm" ] || [ "$TERM" = "eterm-color" ]; then # Emacs term mode doesn't support xterm title escape sequence (\e]0;) PS1="\n\[\033[$PROMPT_COLOR\][\u@\h:\w]\\$\[\033[0m\] " else @@ -173,7 +173,7 @@ in # /etc/bashrc: DO NOT EDIT -- this file has been generated automatically. # Only execute this file once per shell. - if [ -n "$__ETC_BASHRC_SOURCED" -o -n "$NOSYSBASHRC" ]; then return; fi + if [ -n "$__ETC_BASHRC_SOURCED" ] || [ -n "$NOSYSBASHRC" ]; then return; fi __ETC_BASHRC_SOURCED=1 # If the profile was not loaded in a parent process, source |