# How to give arguments to a tex file during compilation?

I have a file called main.tex, which looks like this:

\begin{document}
\input{a.tex}
\end{document}

I want to know if it is possible to have it take this file a.tex in argument, such that I could compile it in a manner that depending on the argument it gives a different output automatically.

Something like pdflatex main.tex < a.tex > a.pdf

-
Does this help: tex.stackexchange.com/questions/24357/… – cmhughes Oct 9 '11 at 15:55
It indeed seems close to tex.stackexchange.com/questions/1492/…. I need to take a closer look, see if I can get my answer. Thanks – Gopi Oct 9 '11 at 16:07
Ok, it is not exactly working the same way since they seem to be working the other way around: changing the headings instead of the content. I suppose theoretically we could do it symetrically but it is not obvious to me :s. – Gopi Oct 9 '11 at 16:18