fork download
  1. #!/bin/bash
  2.  
  3. # ideone boilerplate - we can't write files in the home directory;
  4. # so create a temporary directory for our files instead
  5. t=$(mktemp -d -t ideone.XXXXXXXXXXXX) || exit
  6. trap 'rm -rf "$t"' ERR EXIT
  7. cd "$t"
  8.  
  9. cat <<\: >Makefile
  10. cmd ?= false
  11. $(eval EXISTS=$(shell $(cmd) && echo 1 || echo 0))
  12.  
  13. mst:
  14. ifeq ($(EXISTS), 1)
  15. @echo 'equal'
  16. else
  17. @echo 'not equal'
  18. endif
  19. :
  20.  
  21. echo '** true'
  22. make cmd=true
  23.  
  24. echo '** false'
  25. make
Success #stdin #stdout 0.01s 5680KB
stdin
Standard input is empty
stdout
** true
equal
** false
not equal