rwx/sh/util.sh
2025-07-27 19:12:00 +02:00

44 lines
601 B
Bash

# ╭──────╮
# │ util │
# ╰──────╯
# TODO awk
rwx_not() {
case "${1}" in
"false") echo "true" ;;
"true") echo "false" ;;
*) ;;
esac
}
rwx_read_passphrase() {
rwx_read_secret "PassPhrase: "
}
#| stty
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_remove() {
rm \
--force \
--recursive \
"${@}"
}
rwx_warn_wipe() {
local tmp
rwx_list_block
printf "%s" "WIPE ${*} /?\\ OR CANCEL /!\\"
read -r tmp
rwx_log_trace "${tmp}"
}