Makefile に次のコードがあります。
NODES = celery1 celery2 celery3 priority export
get-status = /bin/bash -c "ps -p `/bin/bash -c '[ -a log/$(1).pid ] && cat log/$(1).pid || echo 1'` -o command= | grep $(1) > /dev/null && echo \"[$(1)] Appears to be running\" || eval 'echo \"[$(1)] Not running\" && exit 1'"
celery-status:
for n in ${NODES}; do $(call get-status,$$n); done
私はそれを機能させることができません。そして私がするとき:
get-status = /bin/bash -c "ps -p `/bin/bash -c '[ -a log/$(1).pid ] && cat log/$(1).pid || echo $(1)'` -o command= | grep $(1) > /dev/null && echo \"[$(1)] Appears to be running\" || eval 'echo \"[$(1)] Not running\" && exit 1'" 1 displaying the argument instead of 1
celery-status:
for n in ${NODES}; do echo $(call get-status,$$n); done # echo the statements
出力は次のとおりです。
/bin/bash -c ps -p -o command= | grep celery1 > /dev/null && echo "[celery1] Appears to be running" || eval 'echo "[celery1] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep celery2 > /dev/null && echo "[celery2] Appears to be running" || eval 'echo "[celery2] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep celery3 > /dev/null && echo "[celery3] Appears to be running" || eval 'echo "[celery3] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep priority > /dev/null && echo "[priority] Appears to be running" || eval 'echo "[priority] Not running" && exit 1'
/bin/bash -c ps -p -o command= | grep export > /dev/null && echo "[export] Appears to be running" || eval 'echo "[export] Not running" && exit 1'
$(1)
正しくエスケープしていない可能性があります。
私はここで少し絶望的です:/