I am trying to solve an issue which is i need to pass user input to here document and loop its value. I am able to only one thing at time, either pass variable or loop. Both are not working.
Below is my code.
bash <<START
echo "Input :$1"
for i in 1 2 3 4 5
do
echo "For Loop Value : $i"
done
START
While running this script ./heredoc "asd" im am getting below output
Input :asd
For Loop Value :
For Loop Value :
For Loop Value :
For Loop Value :
For Loop Value :
As you can see the value of i is not coming.
But if i add single quote it gives below output.
Input :
For Loop Value :1
For Loop Value :2
For Loop Value :3
For Loop Value :4
For Loop Value :5
How can i solve it so that my input value as well as loop value should come in output.
Thanks in advance