I need to have the following work:
$ read -r -p 'input: ' foo
input: <space><space><space>
$ echo "text""$foo""more text"
text more text
Where <space><space><space>
is replaced with actual spaces.
However this is only possible if I set the variable manually:
$ foo=' '
$ echo "text""$foo""more text"
text more text
I thought using -r
, aka raw, would not mess with input like this. How can I perform such a task?
Using bash 3.2.57(1)-release under El Capitan, but am willing to install 3rd party tools if needed.