Fix cleanup in macOS

Refs #12.
This commit is contained in:
Lazarus Lazaridis 2018-03-09 01:25:32 +02:00 committed by GitHub
parent 1370e23ee6
commit 6c92199e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -164,9 +164,13 @@ function _goto_unregister_alias
# Unregisters aliases whose directories no longer exist. # Unregisters aliases whose directories no longer exist.
function _goto_cleanup() function _goto_cleanup()
{ {
if ! [ -f ~/.goto ]; then
return
fi
local IFS=$'\n' match matches al dir local IFS=$'\n' match matches al dir
read -r -a matches <<< "$(cat ~/.goto 2>/dev/null)" read -d '' -r -a matches < ~/.goto
for i in "${!matches[@]}"; do for i in "${!matches[@]}"; do
IFS=' ' read -r -a match <<< "${matches[$i]}" IFS=' ' read -r -a match <<< "${matches[$i]}"