Fix unquoted variables in all shell scripts to prevent word splitting

Co-authored-by: andrejusk <7396847+andrejusk@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-06-04 15:39:06 +00:00
parent da44498341
commit 010d2899b3
9 changed files with 27 additions and 27 deletions

View File

@@ -81,18 +81,18 @@ run() {
for script in $install_dir/*.sh; do
if [[ -n "$targets" ]]; then
script_name=$(basename $script .sh)
script_name=$(basename "$script" .sh)
script_name=${script_name#*-}
if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then
continue
fi
fi
local script_name=$(basename $script)
local script_name=$(basename "$script")
printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n"
local start_time=$(date +%s.%N)
source $script
source "$script"
local end_time=$(date +%s.%N)
local execution_time=$(echo "$end_time - $start_time" | bc)
local execution_ms=$(echo "$execution_time * 1000" | bc | awk '{printf "%.0f", $0}')

View File

@@ -18,14 +18,14 @@ if [ -z "$SKIP_SSH_CONFIG" ]; then
ssh_target="${HOME}/.ssh"
ssh_key="${ssh_target}/id_${ssh_method}"
ssh_pub="${ssh_key}.pub"
if [ ! -f $ssh_key ]; then
if [ ! -f "$ssh_key" ]; then
ssh-keygen \
-t $ssh_method \
-f $ssh_key \
-t "$ssh_method" \
-f "$ssh_key" \
-C "$(whoami)@$(hostname)-$(date -I)"
fi
cat $ssh_pub
cat "$ssh_pub"
unset ssh_method ssh_target ssh_key ssh_pub
else

View File

@@ -29,7 +29,7 @@ export ZSH_SYNTAX_HIGHLIGHTING="$ZSH_CUSTOM/plugins/zsh-syntax-highlighting"
if [ ! -d "$ZSH_SYNTAX_HIGHLIGHTING" ]; then
git clone -q \
https://github.com/zsh-users/zsh-syntax-highlighting.git \
$ZSH_SYNTAX_HIGHLIGHTING
"$ZSH_SYNTAX_HIGHLIGHTING"
fi
# install zsh-autosuggestions
@@ -37,7 +37,7 @@ export ZSH_AUTOSUGGESTIONS="$ZSH_CUSTOM/plugins/zsh-autosuggestions"
if [ ! -d "$ZSH_AUTOSUGGESTIONS" ]; then
git clone -q \
https://github.com/zsh-users/zsh-autosuggestions.git \
$ZSH_AUTOSUGGESTIONS
"$ZSH_AUTOSUGGESTIONS"
fi
# change default shell to zsh

View File

@@ -17,16 +17,16 @@ stow --version
root_dir=${DOTFILES:-$(dirname "$(dirname "$(dirname "$(realpath "$0")")")")}
rm -f $HOME/.bash_profile
rm -f $HOME/.bashrc
rm -f $HOME/.gitconfig
rm -f $HOME/.profile
rm -f $HOME/.zshrc
rm -f $HOME/.p10k.zsh
rm -f $HOME/.ssh/config
rm -f "$HOME/.bash_profile"
rm -f "$HOME/.bashrc"
rm -f "$HOME/.gitconfig"
rm -f "$HOME/.profile"
rm -f "$HOME/.zshrc"
rm -f "$HOME/.p10k.zsh"
rm -f "$HOME/.ssh/config"
mkdir -p $HOME/.config
mkdir -p $HOME/.ssh
mkdir -p "$HOME/.config"
mkdir -p "$HOME/.ssh"
stow --dir="$root_dir/files" --target="$HOME" home
stow --dir="$root_dir/files" --target="$HOME/.config" dot-config

View File

@@ -6,7 +6,7 @@
#
export PYENV_ROOT="$HOME/.pyenv"
if ! echo $PATH | grep -q "$PYENV_ROOT"; then
if ! echo "$PATH" | grep -q "$PYENV_ROOT"; then
export PATH="$PYENV_ROOT/bin:$PATH"
fi
if ! command -v pyenv &>/dev/null; then
@@ -31,7 +31,7 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
if [ ! -d "$virtualenv_path" ]; then
git clone \
https://github.com/pyenv/pyenv-virtualenv.git \
$virtualenv_path
"$virtualenv_path"
fi
unset virtualenv_path
fi

View File

@@ -56,6 +56,6 @@ poetry --version
POETRY_PLUGIN="$ZSH/custom/plugins/poetry"
if [ ! -d "$POETRY_PLUGIN" ]; then
mkdir -p $POETRY_PLUGIN
poetry completions zsh > $POETRY_PLUGIN/_poetry
mkdir -p "$POETRY_PLUGIN"
poetry completions zsh > "$POETRY_PLUGIN/_poetry"
fi

View File

@@ -173,9 +173,9 @@ if [[ "$OSTYPE" == "darwin"* ]]; then
path="${dock_order[$i]}"
name=$(basename "$path" | sed 's/\.app$//')
if [[ $dock_state == *"$name"* ]]; then
dockutil --move "${path}" --position $i --no-restart
dockutil --move "${path}" --position "$i" --no-restart
else
dockutil --add "${path}" --position $i --no-restart
dockutil --add "${path}" --position "$i" --no-restart
fi
fi
done