How can I read from variable with while read line?
For example:
the_list=$(..code..)
while read line
do
echo $line
done < $the_list
using the code above gives me error:
./copy.sh: line 25: $the_list: ambiguous redirect
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 write:
See §3.6.7 “Here Strings” in the Bash Reference Manual.
(I’ve also taken the liberty of adding some double-quotes, and adding
-randIFS=toread, to avoid too much mucking around with the contents of your variables.)