I have a script where I output three things into a file. I'd like to call the >
operator only once. Is there a way to describe a block of instructions? Should I use a function?
#!/bin/sh
for i in $(ls src)
do
f=${i%.*}
echo 'first bit' > dist/$i.htm
perl myScriptThatOutputsSecondBit.pl >> dist/$i.htm
echo 'third bit' >> dist/$i.htm
done