diff --git a/nix/packages/by-name/easyscan/easyscan.sh b/nix/packages/by-name/easyscan/easyscan.sh index 8c8f9ef4..84d6996f 100644 --- a/nix/packages/by-name/easyscan/easyscan.sh +++ b/nix/packages/by-name/easyscan/easyscan.sh @@ -6,11 +6,15 @@ tempdir="$(mktemp -d)" counter=1 while :; do + ok="true" + echo "Scanning page $counter" + # If no size is set, the output will be wonky-sized # 210,297 is the size of A4 - scanimage -x 210 -y 297 --resolution 300 -o "$tempdir/easyscan_$counter.pdf" || + scanimage -x 210 -y 297 --resolution 300 -o "$tempdir/easyscan_$counter.pdf" >/dev/null 2>&1 || { echo "Failed to scan page..." + ok="false" } IFS= read -r -p "Continue scanning? [Y/n] " cont @@ -19,9 +23,12 @@ while :; do echo "Exiting..." break ;; - [yY] | *) ;; + [yY] | *) + if $ok; then + counter=$((counter += 1)) + fi + ;; esac - counter=$((counter += 1)) done # Multiple files are scanned, join them