INNER CODE UNIT · Shell
readArgs
todotxt/todo.txt-cli · todo.sh:385
local readArgs=(-e -r)
if [ -n "${BASH_VERSINFO:-}" ] && ((BASH_VERSINFO[0] > 4 || (BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 1) )); then
readArgs+=(-N 1) # Bash 4.1+ supports -N nchars
fi
local answer
read -rp "${1:?}? (y/n) " "${readArgs[@]}" answer
echo
[ "$answer" = "y" ]
}
cleaninput()
{
# Parameters: When $1 = "for sed", performs additional escaping for use
# in sed substitution with "|" separators.
# Precondition: $input contains text to be cleaned.
# Postcondition: Modifies $input.
# Replace CR and LF with space; tasks always comprise a single line.