I run a
bash command from a
c++ code using the
system function provided
cstdlib. My question is not about the
c++ implementation, but the one
thing that is relevant to my question, is that I have to run multiple command
on one line.
For instance, I run a gnuplot script contained in another directory. So my command is the following:
cd some/path; gnuplot -e gnuplot_file.gp; cd - > /dev/NULL
cd commands are important for personal reasons. I also want to "hide" the ouput in
Here is my question : how do I know the exit status of the
gnuplot command ?
Knowing if it failed is enough.
My problem is that I currently get the exit status of the last command, which
is true even if the
I know that if I use
&& instead of
;, the last command won't be executed if
the previous one fails and the exit status would then be false. But I need the last command to be executed...
What is the workaround ?