mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-08 05:50:38 +00:00
fix(shell): use [[ instead of [ for conditional tests
Replace single brackets with double brackets in bash conditional expressions across 14 files (28 changes). All scripts use bash shebangs so [[ is safe everywhere (SonarCloud rule shelldre:S7688).
This commit is contained in:
@@ -24,7 +24,7 @@ check_required_tools()
|
||||
|
||||
clone_or_update_repo()
|
||||
{
|
||||
if [ ! -d "$PBB_TEMP_DIR/.git" ]; then
|
||||
if [[ ! -d "$PBB_TEMP_DIR/.git" ]]; then
|
||||
msg_run "Starting to clone $PBB_GIT"
|
||||
git clone --depth 1 --single-branch -q "$PBB_GIT" "$PBB_TEMP_DIR" \
|
||||
&& msg_yay "Cloned $PBB_GIT"
|
||||
@@ -41,7 +41,7 @@ prepare_cheat_dest()
|
||||
local cheat_dest
|
||||
cheat_dest="$(cheat -d | grep pure-bash-bible | head -1 | awk '{print $2}')"
|
||||
|
||||
if [ ! -d "$cheat_dest" ]; then
|
||||
if [[ ! -d "$cheat_dest" ]]; then
|
||||
mkdir -p "$cheat_dest"
|
||||
fi
|
||||
|
||||
@@ -83,7 +83,7 @@ process_chapters()
|
||||
LC_ALL=C perl -pi.bak -e 's/\<\!-- CHAPTER END --\>//' "$cheat_file"
|
||||
rm "$cheat_file.bak"
|
||||
|
||||
if [ '---' != "$(head -1 < "$cheat_file")" ]; then
|
||||
if [[ '---' != "$(head -1 < "$cheat_file")" ]]; then
|
||||
local metadata
|
||||
metadata="$PBB_SYNTAX\n$PBB_TAGS\n$PBB_SOURCE\n"
|
||||
printf '%s\n%b%s\n%s' "---" "$metadata" "---" "$(cat "$cheat_file")" > "$cheat_file"
|
||||
|
||||
Reference in New Issue
Block a user