I am currently trying to create a short and portable way to check if my working git directory is dirty and return T/F accordingly. My ultimate goal is to incorporate this into a Makefile and I have implemented it as such:
GIT_DIRTY := $(shell [[ -n $(git status -s) ]] && echo '\ dev')
My issue is that the [[
operator is bash only, and as a requirement this Makefile needs to be able to run with sh
only, no more fully featured shells. My hunch is that there is a way to accomplish this using [
or test
, but I am not sure how.
Thanks!