So I'm really new but I have written a simple bash shell script filter (using someone elses conversion utility) to insert a copyright text line into a MIDI file. The script works fine on the first file in the directory, however the whole point of writing this script for me is to batch whole directories of these files. Is there a standard way of telling such a script to proceed to the next file that fits the same critera (being = *.MID). while not endlessly batching that directory over and over. Also important is the ability to use it on a variety of file names.
I apologize if this is in the wrong place but I figure it's a pretty newbie question.
-------------------------------------------------------------------------
#!/bin/bash
#combines midicomp to text and back out to MIDI with a text line filter and should do so with each file labeled .MID in the current directory
midifile=*.MID
midicomp -d $midifile > tmpmid.tmp
sed '/MTrk/a\
0 Meta Text "Copyright name of company 2005"' tmpmid.tmp | tee cluck.tmp > /dev/null
midicomp -c cluck.tmp $midifile
rm cluck.tmp
rm tmpmid.tmp
--------------------------------------------------------------------
I know it's not very elegantly done, but the other problem is that I couldn't get the stream to directly feed into the recompiling function (midicomp -c) and actually give it any data unless it teed, also making the temporary files necesary. Any ideas?