#!/bin/zsh PINENTRY=@pinentry_mac@/Applications/pinentry-mac.app/Contents/MacOS/pinentry-mac function send() { print -p "$@" read -p } coproc $PINENTRY PINENTRY_PID=$! trap "kill -TERM $PINENTRY_PID" INT TERM read -p send SETDESC $@ case "$@" in "Confirm user presence"*) send SETOK Hide send CONFIRM --one-button ;; *) send GETPIN test "${REPLY:0:3}" = ERR && { coproc : ; exit 1 } echo ${REPLY:2} ;; esac # Close the coproc coproc :