From 01c299e242cb768d575ce385463b5ec66c9a06d6e00eb7496d1fe22d38999b56 Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Sat, 22 Aug 2026 07:45:56 +0200 Subject: [PATCH] fail instead of looping when no mount target can be read --- pbc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pbc b/pbc index 190ee1c..4f0bf99 100755 --- a/pbc +++ b/pbc @@ -360,9 +360,10 @@ case "$action" in target=${args[2]} if [ -z "$target" ]; then + [ ! -t 0 ] && echo "Error: no target path given and stdin is not a terminal" >&2 && exit 1 while [ -z "$target" ]; do echo -n "Target path: " - read -r target + ! read -r target && [ -z "$target" ] && echo "Error: no target path given" >&2 && exit 1 [ -d "$target" ] && break echo -e "\nError: $target: no such directory\n" >&2 target=''