cat /tmp/stuff.txt | yourprog yourprog < /tmp/stuff.txt # if it's just the filename you need (if not, can always use echo -e to print \n newlines): echo filename.ext | yourprog # loop (bash syntax) over all your files and process them: for f in *.dat ; do echo $f | yourprog ; done