我已经制作了一个GNU make文件,以便为count函数批量生成一个简单的脚本。问题是计数器总是为0.你知道解决方案吗?
首先尝试:
__EQUAL := =
$(shell @echo :loop >> checkIfMergingIsEnded.cmd)
$(shell @echo @set counter$(__EQUAL)0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @set /a %counter%+$(__EQUAL)1 >> checkIfMergingIsEnded.cmd)
$(shell @echo @timeout /t 5 >> checkIfMergingIsEnded.cmd)
$(shell @echo @echo %counter% >> checkIfMergingIsEnded.cmd)
$(shell @echo @if %counter% EQU 7 exit /b 0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @goto loop $(__bracket_close) >> checkIfMergingIsEnded.cmd)
第二次尝试:
$(shell @echo :loop >> checkIfMergingIsEnded.cmd)
$(shell @echo @set counter=0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @set /a %counter%=%counter%+1 >> checkIfMergingIsEnded.cmd)
$(shell @echo @timeout /t 5 >> checkIfMergingIsEnded.cmd)
$(shell @echo @echo %counter% >> checkIfMergingIsEnded.cmd)
$(shell @echo @if %counter% EQU 7 exit /b 0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @goto loop $(__bracket_close) >> checkIfMergingIsEnded.cmd)
第三次尝试:
$(shell @echo :loop >> checkIfMergingIsEnded.cmd)
$(shell @echo @set counter=0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @set /a counter=%counter%+1 >> checkIfMergingIsEnded.cmd)
$(shell @echo @timeout /t 5 >> checkIfMergingIsEnded.cmd)
$(shell @echo @echo %counter% >> checkIfMergingIsEnded.cmd)
$(shell @echo @if %counter% EQU 7 exit /b 0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @goto loop $(__bracket_close) >> checkIfMergingIsEnded.cmd)
答案 0 :(得分:0)
所以,这是有效的!谢谢你的帮助:
$(shell @echo @set counter=0 >> checkIfMergingIsEnded.cmd)
$(shell @echo :loop >> checkIfMergingIsEnded.cmd)
$(shell @echo @set /a counter$(__EQUAL)%counter%+1 >> checkIfMergingIsEnded.cmd)
$(shell @echo @timeout /t 5 >> checkIfMergingIsEnded.cmd)
$(shell @echo @echo %counter% >> checkIfMergingIsEnded.cmd)
$(shell @echo @if %counter% EQU 7 exit /b 0 >> checkIfMergingIsEnded.cmd)
$(shell @echo @goto loop $(__bracket_close) >> checkIfMergingIsEnded.cmd)