Bash "read" command: want to preload some data
What I am trying to do is "preload" a bash read command with a value
which can be accepted, edited or changed by the user. Some googling
shows that this is dead easy to with the -i option which appeared in
bash version 4 - I have found this:
---------------------
Example: ask for a path with a default value.
Note: The -i option was introduced with Bash 4.
read -e -p "Enter the path to the file: " -i "/usr/local/etc/" FILEPATH
The user will be prompted, he can just accept the default, or edit it.
---------------------
This is exactly what I want. However, for the sake of compatibility, I
would like to do the same thing using older versions of bash, even if it
means messier coding. Does anyone have any ideas on how to do this
please?
--
Bob Cox. Stoke Gifford, near Bristol, UK.
Please reply to the list only. Do NOT send copies directly to me.
http://bobcox.com/
Reply to: