With Bash, you can append to a variable, example
$ foo=Hello
$ foo+=world
$ echo $foo
Helloworld
However, is this possible with the read command? Something like
$ foo=Hello
$ read --append foo
world
$ echo $foo
Helloworld
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can fake it, kind of, using
readline:When using
readlinevia the-eflag, the argument to-iis put on the first line of the input to get you started. You’re not so much appending tofooas givingfooa whole new value, which just happens to begin with the old value if you don’t edit the initial line.