One solution is Witwith the the builtin readread command.
read -r -p 'Please enter your favorite editor' editor echo "You have enter $editor" Now the value is in the "$editor"$editor" variable, next step would be to test if there is indeed an editor that is installed or within your PATH.
if type "$editor" >/dev/null 2>&1; then command "$editor" ENTER_THE_FILE_YOU_WANT_TO_EDIT else echo "$editor no such file or directory!" >&2 exit 127 fi see
help type help command The 127 exit status is what the shell will exit if there is no executable, alias, function. have a look at
man 1p exit