Found the solution I read before : https://en.wikibooks.org/wiki/LaTeX/Macros#Command-line_LaTeX
If you work on a Unix-like OS, you might be using Makefiles or any
kind of script to build your LaTeX projects. In that connection it
might be interesting to produce different versions of the same
document by calling LaTeX with command-line parameters. If you add the
following structure to your document:
% default value. \providecommand\blackandwhite{false} %...
\ifthenelse{ \equal{\blackandwhite}{true} }{ % "black and white" mode;
do something.. }{ % "color" mode; do something different.. }
Now you can call LaTeX like this:
latex '\providecommand{\blackandwhite}{true}\input{test.tex}'
First the command \blackandwhite gets defined and then the actual file
is read with input. By setting \blackandwhite to false the color
version of the document would be produced.