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=''