rwx_file_write() { local file="${1}" local text="${2}" if [ -n "${file}" ]; then printf "%s" "${text}" > "${file}" fi } rwx_list_block_devices() { lsblk \ --noempty \ --output "NAME,SIZE,TYPE,FSTYPE,LABEL,MOUNTPOINTS" } rwx_not() { case "${1}" in "false") echo "true" ;; "true") echo "false" ;; *) ;; esac } rwx_read_passphrase() { rwx_read_secret "PassPhrase: " } rwx_read_secret() { local prompt="${1}" local secret printf "%s" "${prompt}" 1>&2 stty -echo read -r secret stty echo echo >&2 echo "${secret}" unset secret } rwx_warn_wipe() { local tmp rwx_list_block_devices printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\" read -r tmp rwx_log_trace "${tmp}" }