mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
refractor: Refractor zsh script that cannot be auto-formatted
This commit is contained in:
parent
ae04b4f626
commit
996a64042d
1 changed files with 12 additions and 12 deletions
|
|
@ -14,16 +14,16 @@ read -n 1
|
|||
echo "[INFO] Setting up symbolic links"
|
||||
# 使用 zsh 的关联数组语法
|
||||
for src in ${(k)linkDots}; do
|
||||
dest="${linkDots[$src]}"
|
||||
echo "Linking $src to $dest"
|
||||
if [ -d "$src" ]; then
|
||||
test -d $dest && mv $dest $dest.bak
|
||||
ln -sf $src $dest
|
||||
elif [ -f "$src" ]; then
|
||||
dest_parent=$(dirname $dest)
|
||||
test -d $dest_parent || mkdir -p $dest_parent
|
||||
ln -sf $src $dest
|
||||
else
|
||||
echo "[ERROR] $src does not exist"
|
||||
fi
|
||||
dest="${linkDots[$src]}"
|
||||
echo "Linking $src to $dest"
|
||||
if [ -d "$src" ]; then
|
||||
test -d $dest && mv $dest $dest.bak
|
||||
ln -sf $src $dest
|
||||
elif [ -f "$src" ]; then
|
||||
dest_parent=$(dirname $dest)
|
||||
test -d $dest_parent || mkdir -p $dest_parent
|
||||
ln -sf $src $dest
|
||||
else
|
||||
echo "[ERROR] $src does not exist"
|
||||
fi
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue