1

The "sync-mongo" file can either contain a git commit id, or 0. When the file contains 0, the if statement still isn't entered.

COMMITID=`docker exec -it ${NAME} bash -c 'cd /usr/src/app/_api; cat sync-mongo.commit'`

if [ "${COMMITID}" == "0" ]
then
  ./_configuremongo.sh -i $INPUT -o $OUTPUT -r
fi

I've also tried:

if [ ${COMMITID} -eq 0 ]
then
  ./_configuremongo.sh -i $INPUT -o $OUTPUT -r
fi

which returns : integer expression expected[: 0

WilliamNHarvey
  • 2,335
  • 2
  • 17
  • 26

1 Answers1

0

Maybe you have a cd alias that sends an escape sequence, and that's included in the output to $COMMITID. Try just using an absolute pathname:

COMMITID=`docker exec -it ${NAME} bash -c 'cat /usr/src/app/_api/sync-mongo.commit'`
Barmar
  • 741,623
  • 53
  • 500
  • 612