You can also read from a text file created dynamically from within your script.
./doubleword < mynovel.txt myprog <<BAR 320 512 $nstars `wc -l < brightnesses.txt` testimage BAR commentary <<\foo The AITCH package offers unrivalled facilities. It is also easy to use because of its GUI interface. Save $$$ if you buy now. fooCommand ./doubleword reads its standard input from the file mynovel.txt. The «word obtains the input data from the script file itself until there is line beginning word. You may also include variables and commands to execute as the $,
\, and ` ` retain their special meaning. If you want these characters to be treated literally, say to prevent substitution, insert a
\before the delimiting word. The command myprog reads from the script, substituting the value of variable nstars in the second line, and the number of lines in file brightnesses.txt in the third line.
The technical term for such files are here documents.