Say, I have my POSIX script introduction stored in variable:
script_intro=\
'------------------------------------------------------------
-- Safe system files editing as root --
-- Code language: POSIX shell script --
-- Copyright: 2020-2023 Vlastimil Burian --
-- Email: [email protected] --
-- GitHub: https://git.io/Jvnzq --
-- License: The Unlicense --
-- Version 5.0 (stable) --
-- Released: 2023-Feb-13 --
------------------------------------------------------------'
This was actually made by boxes (boxes -d ada-box -a c -s 60).
And now say we have a function to ask if the user wants to display that intro and I want that done by default (y*/Enter), where the interesting part is the Enter key which was mostly attributed to this answer.
sudoedit_help ()
{
printf '%s' 'sudoedit-enhanced: Do you wish to print intro? [Y/Enter] / ? '
IFS= read -r print_intro
case "$print_intro" in
([Yy]*|'') printf '%s\n' "$script_intro"
esac
cat << EOF
Main useful info like usage...
Usage example: suvim /path/to/file1 /path/to/file2
EOF
}