I have a sentence that the bash program is asking a user to make an edit to. Let's say the sentence is "The quick brown fox jumps over the lazy dog". Right now, I echo the sentence and then ask the user to respond back with the edited version.
echo "The quick brown fox jumps over the lazy dog"
read -p "Edit: " newSentenceVariable
--> Will show: Edit: (user inputs edited sentence) (user return)
Is it possible to do something where the user's input is already pre-filled with the initial sentence, so that they can make their edits and then hit enter.
read -p "Edit: " "The quick brown fox jumps over the lazy dog" newSentenceVariable
---> Would show: Edit: The quick brown fox jumps over the lazy dog
This way, if there are no edits to be made to the sentence, the user just hits enter. And if they have to add a period to the sentence, they type "." and then the return key. This would all be instead of making the user copy/paste or re-type the whole sentence into the prompt response.
Thanks
echo $BASH_VERSION
3.2.57(1)-release