I need to execute series of commands inside an interactive program/utility with parameterized values. Is there a way to loop inside heredoc ? Like below .. Not sure if
list="OBJECT1 OBJECT2 OBJECT3"
utilityExecutable << EOF
for i in $list ; do
Instead of passing a here-document to
the equivalent is to pipe the required text to it. You can create the desired text using
echo statements in a for-loop, and pipe the entire loop output to
#!/bin/sh list="OBJECT1 OBJECT2 OBJECT3" for i in $list; do echo "utilityCommand $i" done | utilityExecutable