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
function add-export {
if ! grep "$1" "$HOME/.zsh_local" &> /dev/null; then
echo "$1\"$2\"" >> "$HOME/.zsh_local"
local final="$1\"$2\""
if grep "$final" "$HOME/.zsh_local" &> /dev/null; then
return
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"