OSDN Git Service

[fix] : No error with blank files
authorhayao <hayao@fascode.net>
Tue, 19 Jan 2021 12:48:26 +0000 (21:48 +0900)
committerhayao <hayao@fascode.net>
Tue, 19 Jan 2021 12:48:26 +0000 (21:48 +0900)
alterlinux-gtk-bookmarks/alterlinux-gtk-bookmarks

index 87a198c..3d55c6c 100755 (executable)
@@ -204,7 +204,7 @@ case "${1}" in
         ;;
     init)
         shift 1
-        if [[ -f "${bookmark_file}" ]] && [[ "${force}" = false ]] && [[ "${simulation}" = false ]]; then
+        if [[ -f "${bookmark_file}" ]] && [[ "${force}" = false ]] && [[ "${simulation}" = false ]] && [[ -n "$(cat "${bookmark_file}" 2>/dev/null)" ]]; then
             _msg_error "The sidebar already exists. Use -f to force initialization."
             exit 1
         else