From 6c92199e20b896ef238b0b47838c4502e7cc89a5 Mon Sep 17 00:00:00 2001 From: Lazarus Lazaridis Date: Fri, 9 Mar 2018 01:25:32 +0200 Subject: [PATCH] Fix cleanup in macOS Refs #12. --- goto.bash | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/goto.bash b/goto.bash index b3ef6c0..747fc38 100644 --- a/goto.bash +++ b/goto.bash @@ -164,9 +164,13 @@ function _goto_unregister_alias # Unregisters aliases whose directories no longer exist. function _goto_cleanup() { + if ! [ -f ~/.goto ]; then + return + fi + 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 IFS=' ' read -r -a match <<< "${matches[$i]}"