From c842c23a067977a1ec9edb28e1feb062c1b08a41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 27 Jul 2021 01:00:12 +0200 Subject: savepatch: Wait for text on stdin before asking for confirmation --- bin/savepatch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/savepatch b/bin/savepatch index 2a6cec9..963fbab 100755 --- a/bin/savepatch +++ b/bin/savepatch @@ -11,8 +11,10 @@ dir=$(whereispatch -i) mkdir -p "$dir" +read -r first if [ -e "$dir/$1" ]; then - printf "%s: %s already exists; overwrite? " "${0##*/}" "$dir/$1" 1>&2 + printf "%s: %s already exists; overwrite? " \ + "${0##*/}" "${dir#/home/*/patches/}/$1" 1>&2 read ans "$dir/$1" +{ echo "$first"; cat; } > "$dir/$1" echo "$dir/$1" -- cgit v1.2.3