test LUKS passphrase

Disable bash history.
set +o history

test correct passphrase
printf "currentpassphrase" | cryptsetup luksOpen --test-passphrase /dev/sda2 && echo "passphrase is ok."

Enable bash history
set -o history