I have got a shell script and a programme and try to debug the weird behaviour of the given shell script. It looks like that:
#!/bin/bash
cd ~/codebase/build
rm bin/*
rm -R runs
cmake ~/codebase/
make
mkdir runs
for i in ./bin/*
do
mkdir results
mkdir results/indexes
mkdir results/workloads
echo "Executing $i"
$i >checksum.txt
mv checksum.txt runs/$(basename "$i")_checksum.txt
mv results runs/$(basename "$i")_outputs
done
It goes into build, deletes some folders in there and then runs cmake on the upper directory. Then it does make and then it loops around in the bin folder which was created by the cmake command.
My problem is the following: The cmake command resets the folder. Before cmake, I am in ./build/, but after cmake, I am in ./ again. But if Cmake did not find changes from last compilation, it doesnt run so it stays in ./build/. This is a weird behaviour I cannot really control. Is there a trick to stop this?