Merge pull request #53 from andrejusk/copilot/fix-52

Fix unquoted variable in mkdir command to prevent word splitting
This commit is contained in:
2025-06-04 16:55:45 +01:00
committed by GitHub
9 changed files with 28 additions and 28 deletions

View File

@@ -10,7 +10,7 @@ mkdir -p "$XDG_CONFIG_HOME"
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
export PATH="$HOME/.local/bin:$PATH" export PATH="$HOME/.local/bin:$PATH"
fi fi
mkdir -p $HOME/.local/bin mkdir -p "$HOME/.local/bin"
# workspace # workspace
# ----------------------------------------------------------------- # -----------------------------------------------------------------
@@ -36,7 +36,7 @@ _dots_load_nvm
node_alias="$NVM_DIR/alias/lts/jod" node_alias="$NVM_DIR/alias/lts/jod"
if [ -f "$node_alias" ]; then if [ -f "$node_alias" ]; then
VERSION=`cat $node_alias` VERSION=`cat "$node_alias"`
node_bin_path="$NVM_DIR/versions/node/$VERSION/bin" node_bin_path="$NVM_DIR/versions/node/$VERSION/bin"
if [[ ":$PATH:" != *":$node_bin_path:"* ]]; then if [[ ":$PATH:" != *":$node_bin_path:"* ]]; then
export PATH="$node_bin_path:$PATH" export PATH="$node_bin_path:$PATH"

View File

@@ -7,7 +7,7 @@ fi
# Load profile # Load profile
# ----------------------------------------------------------------------------- # -----------------------------------------------------------------------------
_dots_load_profile() { _dots_load_profile() {
source $HOME/.profile source "$HOME/.profile"
} }
_dots_load_profile _dots_load_profile
@@ -21,7 +21,7 @@ _dots_load_omz() {
zsh-autosuggestions zsh-autosuggestions
zsh-syntax-highlighting zsh-syntax-highlighting
) )
source $ZSH/oh-my-zsh.sh source "$ZSH/oh-my-zsh.sh"
} }
_dots_load_omz _dots_load_omz

View File

@@ -81,18 +81,18 @@ run() {
for script in $install_dir/*.sh; do for script in $install_dir/*.sh; do
if [[ -n "$targets" ]]; then if [[ -n "$targets" ]]; then
script_name=$(basename $script .sh) script_name=$(basename "$script" .sh)
script_name=${script_name#*-} script_name=${script_name#*-}
if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then if [[ ! " ${targets[*]} " =~ " $script_name " ]]; then
continue continue
fi fi
fi fi
local script_name=$(basename $script) local script_name=$(basename "$script")
printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n" printf "\n\n${CYAN}<<< ${CYAN_BOLD}$script_name:${NC}\n"
local start_time=$(date +%s.%N) local start_time=$(date +%s.%N)
source $script source "$script"
local end_time=$(date +%s.%N) local end_time=$(date +%s.%N)
local execution_time=$(echo "$end_time - $start_time" | bc) local execution_time=$(echo "$end_time - $start_time" | bc)
local execution_ms=$(echo "$execution_time * 1000" | bc | awk '{printf "%.0f", $0}') 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_target="${HOME}/.ssh"
ssh_key="${ssh_target}/id_${ssh_method}" ssh_key="${ssh_target}/id_${ssh_method}"
ssh_pub="${ssh_key}.pub" ssh_pub="${ssh_key}.pub"
if [ ! -f $ssh_key ]; then if [ ! -f "$ssh_key" ]; then
ssh-keygen \ ssh-keygen \
-t $ssh_method \ -t "$ssh_method" \
-f $ssh_key \ -f "$ssh_key" \
-C "$(whoami)@$(hostname)-$(date -I)" -C "$(whoami)@$(hostname)-$(date -I)"
fi fi
cat $ssh_pub cat "$ssh_pub"
unset ssh_method ssh_target ssh_key ssh_pub unset ssh_method ssh_target ssh_key ssh_pub
else else

View File

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

View File

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

View File

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

View File

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

View File

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