I'm on Ubuntu 14.04 with Ruby 1.9.3. I'm trying to present an editable input to the user. The only solution I happened to find was using the read command from the bash-shell: read -e -i "Default Value" -p "Prompt> " ; echo $REPLY Executed from the command line it works well, the edited input is in the REPLY variable. But if I define
def edits
`read -e -i "Default Value" -p "Prompt> ; echo $REPLY" `
end
and run it in ruby I get an error:
sh: 1: read: Illegal option -e
My questions are now:
- What went wrong in my solution?
- Is there a better solution in ruby?