I don't think this is possible. I would use a simple preprocessor for that. I.e. change the document to
\documentclass{article}
\begin{document}
%%OUTPUT%%
\end{document}
and preprocess it with
#!/usr/bin/perl -lp
BEGIN { $output = `/usr/local/bin/my-shell-script.sh`; }
s/%%OUTPUT%%/$output/g;
Command:
perl so.pl template.tex > preprocessed.tex
or in-place:
perl -i so.pl template.tex