Compare commits
2 Commits
8edc202815
...
d8ef23aa61
Author | SHA1 | Date |
---|---|---|
Sage Vaillancourt | d8ef23aa61 | |
Sage Vaillancourt | 159243c3f9 |
11
copy.sh
11
copy.sh
|
@ -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"
|
||||||
|
|
Loading…
Reference in New Issue