From 151a54703cbab18031e692bd58dbda7ab2d1c9f9 Mon Sep 17 00:00:00 2001 From: Stoiko Ivanov Date: Fri, 11 Feb 2022 16:15:41 +0100 Subject: [PATCH] proxmox-boot: return empty if file does not exist in get_first_line MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit makes using this helper shorter in most cases Signed-off-by: Stoiko Ivanov Reviewed-by: Fabian Grünbichler Tested-by: Fabian Grünbichler Signed-off-by: Thomas Lamprecht --- proxmox-boot/functions | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/proxmox-boot/functions b/proxmox-boot/functions index 4515a2d..27da363 100755 --- a/proxmox-boot/functions +++ b/proxmox-boot/functions @@ -104,6 +104,11 @@ loop_esp_list() { get_first_line() { file="$1" + if [ ! -e "$file" ]; then + echo "" + return + fi + while IFS= read -r line || [ -n "$line" ]; do break done < "${file}"