I'm a nube to more than just bash, however; I've written a bash script that will execute my cmake, make, and c++ executable.
#! /bin/bash
cmake .
make
./pcl_visualizer_demo <-- This is my executable
This works great except when my code fails to compile it executes the old executable and leaves me with a mess. I was hoping to put the output of make into an if statement that only runs the executable when make is successful. I've tried a great many bash things from other posts here on stackoverflow. Some of the problems seem to be that the output of make is not a string for example:
OUTPUT = make
echo $OUTPUT
gives:
[100%] Built target pcl_visualizer_demo
But fails to work with:
if [`expr match "$OUTPUT" '[100%] -eq 5]; then ./pcl_visulizer_demo; fi
Not to mention I think there may be more than one thing wrong with this line. I also tried:
if [diff <(echo "$OUTPUT") <(echo '[100%] Built target pcl_visualizer_demo' -n]; then ./pcl_visulizer_demo; fi
Again it could be that I'm not implementing it right. Any help