Interactive editing of a string in BASH

If you want to present a string to a user in a BASH script and allow the user to interactively edit it, such as presenting a command before execution, the way to do it is like this:1)

read -e -i "$value" $value

You can of course put the edited text into a new variable so that it can be compared, e.g.:

read -e -i "$value" $new_value
if [[ $value != $new_value ]]
then
  do interesting things
fi

1)
This ability was first available in BASH version 4 in 2009. ref. Bash_(Unix_shell)