Skip to content
This repository was archived by the owner on Oct 17, 2025. It is now read-only.

Commit e825895

Browse files
committed
Ensure using "-literal around string variable
1 parent 880179d commit e825895

File tree

9 files changed

+157
-158
lines changed

9 files changed

+157
-158
lines changed

smud-cli/download-and-install-cli.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env bash
2-
HOME_DIR=$(dirname `readlink -f ~/.bashrc`)
2+
HOME_DIR="$(dirname `readlink -f ~/.bashrc`)"
33
VERSION="LATEST"
44
folder=smud-cli
5-
curr_dir=$(pwd)
6-
destination_folder=$HOME_DIR/$folder
7-
download_folder=$HOME_DIR/$folder-downloaded
8-
download_json_file=$download_folder/downloaded-info.json
5+
curr_dir="$(pwd)"
6+
destination_folder="$HOME_DIR/$folder"
7+
download_folder="$HOME_DIR/$folder-downloaded"
8+
download_json_file="$download_folder/downloaded-info.json"
99
if [ -d "$download_folder" ];then
1010
rm -rf $download_folder
1111
fi
@@ -61,7 +61,7 @@ for url in "${download_urls[@]}"; do
6161
if [ ! "$file" ]; then
6262
file="$(echo "$url"|sed -e 's/.*\/main\/smud-cli\/\(.*\)/\1/g')"
6363
fi
64-
downloaded_file=$(basename $url)
64+
downloaded_file="$(basename $url)"
6565
if [ "$file" ]; then
6666
printf "${gray}Download '$file' file: ${normal}\n"
6767
# echo "Download:$url => $file"

smud-cli/functions-gitops.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ gitops_model__show_changelog_file()
6161
{
6262
from="$1"
6363
if [ "$from" = "git" ]; then
64-
revisions=$git_range
64+
revisions="$git_range"
6565
if [ ! "$revisions" ]; then
6666
echo "No revisions available to fetch GitOps-model Changelog!"
6767
return
@@ -78,8 +78,8 @@ gitops_model__show_changelog_file()
7878
}
7979
else
8080
local context="Current"
81-
BASEDIR=$(dirname "$0")
82-
file=$BASEDIR/CHANGELOG.md
81+
BASEDIR="$(dirname "$0")"
82+
file="$BASEDIR/CHANGELOG.md"
8383
if [ -f $file ]; then
8484
show_changelog_command="cat $file"
8585
fi

smud-cli/functions-init.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ set_upstream()
4141
print_not_silent "${gray}Upstream configured with '$new_upstream' ${normal}\n"
4242
fi
4343
elif [ ! "$new_upstream" ]; then
44-
new_upstream=$default_upstream
44+
new_upstream="$default_upstream"
4545
add_upstream_command="git remote add upstream $new_upstream"
4646
run_command add_upstream_command --command-from-var=add_upstream_command --debug-title='Adding upstream with default URL'
4747
print_not_silent "${gray}Upstream configured with '$new_upstream' ${normal}\n"
@@ -96,7 +96,7 @@ init_repo()
9696
run_command init-repo --command-from-var=init_command --return-var=dummy --debug-title='Initializing repository' || return
9797
is_repo="true"
9898

99-
branches=$(git branch)
99+
branches="$(git branch)"
100100
if [ ! -n "$branches" ]; then
101101
# "main" possibly not default branch name so create it
102102
create_main_branch="git checkout -b main"
@@ -114,7 +114,7 @@ fetch_upstream()
114114
init()
115115
{
116116
if [ "$help" ]; then
117-
func=${1:-init}
117+
func="${1:-init}"
118118
echo "${bold}smud $func${normal}: Initializes local repository and sets upstream, origin remotes and source-branch"
119119
printf "Upstream: \n"
120120
printf " With Only ${green}$func${normal}, Upstream '$default_upstream' will be configured if not configured yet. When configured the upstream will be fetched. \n"
@@ -136,8 +136,8 @@ init()
136136
upstream_url="$first_param"
137137
fi
138138
fi
139-
remote_origin=$(git config --get remote.origin.url)
140-
remote_upstream=$(git config --get remote.upstream.url)
139+
remote_origin="$(git config --get remote.origin.url)"
140+
remote_upstream="$(git config --get remote.upstream.url)"
141141

142142
if [ ! "$remote_upstream" ] || [ "$upstream_url" ]; then
143143
if [ ! "$upstream_url" ]; then
@@ -166,18 +166,18 @@ init()
166166

167167
if [ "$is_repo" ]; then
168168
if [ ! "$source_branch" ]; then
169-
source_branch=$(git config --get source.$current_branch)
169+
source_branch="$(git config --get source.$current_branch)"
170170
fi
171171
if [ ! "$source_branch" ]; then
172172
source_branch="upstream/$default_branch"
173173
fi
174174

175-
old=$(git config --get source.$current_branch)
175+
old="$(git config --get source.$current_branch)"
176176
if [ ! "$old" = "$source_branch" ] || [ ! "$old" ] ; then
177177
if [ "$old" ]; then
178-
dummy=$(git config --unset source.$current_branch)
178+
dummy="$(git config --unset source.$current_branch)"
179179
fi
180-
dummy=$(git config --add source.$current_branch $source_branch)
180+
dummy="$(git config --add source.$current_branch $source_branch)"
181181
fi
182182
fi
183183

0 commit comments

Comments
 (0)