The following MWE code is working perfectly in TexLive2018 but is not working in "www.overleaf.com" (an online Latex platform).
\documentclass{article}
\ifx\conditionmacro\undefined
\immediate\write18{%
pdfLaTeX --jobname="\jobname1"
\gdef\string\conditionmacro{1}\string\input\space\jobname
}%
\immediate\write18{%
pdfLaTeX --jobname="\jobname2"
\gdef\string\conditionmacro{2}\string\input\space\jobname
}%
\immediate\write18{%
pdfLaTeX --jobname="\jobname3"
\gdef\string\conditionmacro{3}\string\input\space\jobname
}%
\expandafter\stop
\fi
\begin{document}
\ifnum\conditionmacro=1
Condition is 1
\fi
\ifnum\conditionmacro=2
Condition is 2
\fi
\ifnum\conditionmacro=3
Condition is 3
\fi
\verb|\conditionmacro| is \texttt{\meaning\conditionmacro}.
\end{document}
The raw log from "www.overleaf.com" is as follows:
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex 2019.8.28) 28 NOV 2019 12:59 entering extended mode \write18 enabled. %&-line parsing enabled. **main.tex (/compile/main.tex LaTeX2e <2018-12-01> (/usr/local/texlive/2018/texmf-dist/tex/latex/base/article.cls Document Class: article 2018/09/03 v1.4i Standard LaTeX document class (/usr/local/texlive/2018/texmf-dist/tex/latex/base/size10.clo File: size10.clo 2018/09/03 v1.4i Standard LaTeX file (size option) ) \c@part=\count80 \c@section=\count81 \c@subsection=\count82 \c@subsubsection=\count83 \c@paragraph=\count84 \c@subparagraph=\count85 \c@figure=\count86 \c@table=\count87 \abovecaptionskip=\skip41 \belowcaptionskip=\skip42 \bibindent=\dimen102 ) runsystem(pdfLaTeX --jobname="output1" \gdef \conditionmacro{1}\input output).. .executed.
runsystem(pdfLaTeX --jobname="output2" \gdef \conditionmacro{2}\input output).. .executed.
runsystem(pdfLaTeX --jobname="output3" \gdef \conditionmacro{3}\input output).. .executed.
) Here is how much of TeX's memory you used: 198 strings out of 492616 2143 string characters out of 6128979 59595 words of memory out of 5000000 4200 multiletter control sequences out of 15000+600000 3640 words of font info for 14 fonts, out of 8000000 for 9000 1141 hyphenation exceptions out of 8191 23i,1n,17p,112b,36s stack positions out of 5000i,500n,10000p,200000b,80000s
No pages of output. PDF statistics: 0 PDF objects out of 1000 (max. 8388607) 0 named destinations out of 1000 (max. 500000) 1 words of extra memory for PDF output out of 10000 (max. 10000000)
CAN SOMEBODY PLEASE HELP ME??
--shell-escapeand imho overleaf doesn't allow this. – Ulrike Fischer Nov 28 '19 at 13:22--shell-escapeconveys some security threats. I'll though double-check what exactly is going on here, and then eventually answer you in more detail. – yo' Nov 28 '19 at 13:27shell-escaperestriction, but in\jobnamechanges. See the answer. – yo' Nov 28 '19 at 13:57