Merge pull request #53 from andrejusk/copilot/fix-52
Fix unquoted variable in mkdir command to prevent word splitting
This commit is contained in:
@@ -10,7 +10,7 @@ mkdir -p "$XDG_CONFIG_HOME"
|
||||
if [[ ":$PATH:" != *":$HOME/.local/bin:"* ]]; then
|
||||
export PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
mkdir -p $HOME/.local/bin
|
||||
mkdir -p "$HOME/.local/bin"
|
||||
|
||||
# workspace
|
||||
# -----------------------------------------------------------------
|
||||
@@ -36,7 +36,7 @@ _dots_load_nvm
|
||||
|
||||
node_alias="$NVM_DIR/alias/lts/jod"
|
||||
if [ -f "$node_alias" ]; then
|
||||
VERSION=`cat $node_alias`
|
||||
VERSION=`cat "$node_alias"`
|
||||
node_bin_path="$NVM_DIR/versions/node/$VERSION/bin"
|
||||
if [[ ":$PATH:" != *":$node_bin_path:"* ]]; then
|
||||
export PATH="$node_bin_path:$PATH"
|
||||
|
||||
@@ -7,7 +7,7 @@ fi
|
||||
# Load profile
|
||||
# -----------------------------------------------------------------------------
|
||||
_dots_load_profile() {
|
||||
source $HOME/.profile
|
||||
source "$HOME/.profile"
|
||||
}
|
||||
_dots_load_profile
|
||||
|
||||
@@ -21,7 +21,7 @@ _dots_load_omz() {
|
||||
zsh-autosuggestions
|
||||
zsh-syntax-highlighting
|
||||
)
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
source "$ZSH/oh-my-zsh.sh"
|
||||
}
|
||||
_dots_load_omz
|
||||
|
||||
|
||||
@@ -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}')
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user