Compare commits

...

2 Commits

1 changed files with 9 additions and 2 deletions

11
copy.sh
View File

@ -38,9 +38,16 @@ echo "$dotfiles" | while read -r dotfile; do
done done
function add-export { function add-export {
if ! grep "$1" "$HOME/.zsh_local" &> /dev/null; then local final="$1\"$2\""
echo "$1\"$2\"" >> "$HOME/.zsh_local" if grep "$final" "$HOME/.zsh_local" &> /dev/null; then
return
fi fi
if grep "$1" "$HOME/.zsh_local" &> /dev/null; then
echo "Replacing '$(grep "$1" "$HOME/.zsh_local")' with '$final'"
local escaped="$(echo "$1" | sed 's@/@\\/@g')"
sed -i "/$escaped/d" "$HOME/.zsh_local"
fi
echo "$final" >> "$HOME/.zsh_local"
} }
add-export "export DOT_DIR=" "$SCRIPT_DIR" add-export "export DOT_DIR=" "$SCRIPT_DIR"